Class: TrueConf::Response
- Inherits:
-
Object
- Object
- TrueConf::Response
show all
- Extended by:
- Dry::Initializer
- Defined in:
- lib/true-conf/response.rb
Direct Known Subclasses
Entity::Call, Entity::CallList, Entity::CallParticipant, Entity::CallParticipantList, Entity::Conference, Entity::ConferenceSimple, Entity::DateTime, Entity::Invitation, Entity::InvitationList, Entity::InvitationSimple, Entity::Participant, Entity::Record, Entity::RecordList, Entity::User, Entity::UserList, Entity::UserSimple, Error
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.build(*res) ⇒ Object
16
17
18
19
20
|
# File 'lib/true-conf/response.rb', line 16
def build(*res)
body = res.last
attr = name.split("::").last.downcase
new JSON.parse(body.first)[attr]
end
|
.new(opts) ⇒ Object
22
23
24
|
# File 'lib/true-conf/response.rb', line 22
def new(opts)
super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
end
|
Instance Method Details
#error? ⇒ Boolean
7
8
9
|
# File 'lib/true-conf/response.rb', line 7
def error?
is_a?(TrueConf::Error)
end
|
#success? ⇒ Boolean
11
12
13
|
# File 'lib/true-conf/response.rb', line 11
def success?
!error?
end
|