Class: Amdapi::GetCall
- Defined in:
- lib/amdapi/resources/get_call.rb
Constant Summary
Constants inherited from Resource
Instance Attribute Summary collapse
-
#call_uuid ⇒ Object
readonly
Returns the value of attribute call_uuid.
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #find ⇒ Object
-
#initialize(call_uuid = "", token, adapter, stubs) ⇒ GetCall
constructor
A new instance of GetCall.
Methods inherited from Resource
#delete_call, #get_all_request, #get_request, #post_audio_request, #post_call_request
Constructor Details
#initialize(call_uuid = "", token, adapter, stubs) ⇒ GetCall
Returns a new instance of GetCall.
7 8 9 10 |
# File 'lib/amdapi/resources/get_call.rb', line 7 def initialize(call_uuid = "", token, adapter, stubs) @call_uuid = call_uuid super(token, adapter: adapter, stubs: stubs) end |
Instance Attribute Details
#call_uuid ⇒ Object (readonly)
Returns the value of attribute call_uuid.
5 6 7 |
# File 'lib/amdapi/resources/get_call.rb', line 5 def call_uuid @call_uuid end |
Instance Method Details
#all(params = {}) ⇒ Object
20 21 22 23 |
# File 'lib/amdapi/resources/get_call.rb', line 20 def all(params = {}) response = get_all_request(params: params, headers: headers) Collection.from_response JSON.parse(response.body)["data"] end |
#find ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/amdapi/resources/get_call.rb', line 12 def find response = get_request(call_uuid, headers: headers) raise CallNotFoundError if response.status == 404 data = JSON.parse(response.body)["data"] Call.new data, call_uuid: data["call_uuid"], token: token end |