Class: Amdapi::Resource
- Inherits:
-
Object
show all
- Defined in:
- lib/amdapi/resource.rb
Constant Summary
collapse
- BASE_URL =
"https://api-amdapi.com"
Instance Method Summary
collapse
-
#delete_call(call_uuid, params: {}, headers: {}) ⇒ Object
-
#get_all_request(params: {}, headers: {}) ⇒ Object
-
#get_request(call_uuid = nil, params: {}, headers: {}) ⇒ Object
-
#initialize(token, adapter: Faraday.default_adapter, stubs: nil) ⇒ Resource
constructor
A new instance of Resource.
-
#post_audio_request(url, file, headers: {}) ⇒ Object
-
#post_call_request(params, headers: {}) ⇒ Object
Constructor Details
#initialize(token, adapter: Faraday.default_adapter, stubs: nil) ⇒ Resource
Returns a new instance of Resource.
7
8
9
10
11
|
# File 'lib/amdapi/resource.rb', line 7
def initialize(token, adapter: Faraday.default_adapter, stubs: nil)
@token = token
@adapter = adapter
@stubs = stubs
end
|
Instance Method Details
#delete_call(call_uuid, params: {}, headers: {}) ⇒ Object
29
30
31
|
# File 'lib/amdapi/resource.rb', line 29
def delete_call(call_uuid, params: {}, headers: {})
connection.delete("v1/calls/#{call_uuid}", params, .merge())
end
|
#get_all_request(params: {}, headers: {}) ⇒ Object
17
18
19
|
# File 'lib/amdapi/resource.rb', line 17
def get_all_request(params: {}, headers: {})
connection.get("v1/calls", params, .merge())
end
|
#get_request(call_uuid = nil, params: {}, headers: {}) ⇒ Object
13
14
15
|
# File 'lib/amdapi/resource.rb', line 13
def get_request(call_uuid = nil, params: {}, headers: {})
connection.get("v1/calls/#{call_uuid}", params, .merge())
end
|
#post_audio_request(url, file, headers: {}) ⇒ Object
25
26
27
|
# File 'lib/amdapi/resource.rb', line 25
def post_audio_request(url, file, headers: {})
connection.put(url, file, )
end
|
#post_call_request(params, headers: {}) ⇒ Object
21
22
23
|
# File 'lib/amdapi/resource.rb', line 21
def post_call_request(params, headers: {})
connection.post("amda-pi-storage", params.to_json, .merge())
end
|