Class: JustCall::Call
- Inherits:
-
Base
- Object
- Base
- JustCall::Call
show all
- Includes:
- API
- Defined in:
- lib/justcall_ruby/call.rb
Constant Summary
collapse
- LIST_ATTRS =
{
permitted: %i[
fetch_queue_data fetch_iq_data page per_page sort order from_datetime to_datetime
contact_number justcall_number agent_id ivr_digit call_direction call_type
].freeze,
}.freeze
- FETCH_ATTRS =
{
permitted: %i[fetch_queue_data fetch_iq_data].freeze,
}.freeze
- UPDATE_ATTRS =
{
permitted: %i[notes disposition_code rating].freeze,
}.freeze
- CHECK_REPLY_ATTRS =
{
permitted: %i[contact_number justcall_number].freeze,
required: %i[contact_number].freeze,
}.freeze
- SEND_ATTRS =
{
permitted: %i[justcall_number body contact_number media_url restrict_once].freeze,
required: %i[justcall_number body contact_number].freeze,
}.freeze
- ENDPOINTS =
{
list: "calls?%s".freeze,
fetch: "calls/%s?%s".freeze,
update: "calls/%s".freeze,
download_recording: "calls/%s/recording/download".freeze,
}.freeze
Constants included
from API
API::ROOT_URL, API::USER_AGENT
Instance Method Summary
collapse
Methods inherited from Base
requires!
Constructor Details
#initialize(client:) ⇒ Call
Returns a new instance of Call.
39
40
41
|
# File 'lib/justcall_ruby/call.rb', line 39
def initialize(client:)
@client = client
end
|
Instance Method Details
#download_recording(call_id) ⇒ Object
64
65
66
67
68
|
# File 'lib/justcall_ruby/call.rb', line 64
def download_recording(call_id)
endpoint = ENDPOINTS[:download_recording] % call_id
get_request(client: @client, endpoint: endpoint)
end
|
#fetch(call_id, params = {}) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/justcall_ruby/call.rb', line 50
def fetch(call_id, params = {})
params = standardize_body_data(submitted_attrs: params, permitted_attrs: FETCH_ATTRS[:permitted])
endpoint = ENDPOINTS[:fetch] % [call_id, convert_params_to_request_query(params)]
get_request(client: @client, endpoint: endpoint)
end
|
#list(params = {}) ⇒ Object
43
44
45
46
47
48
|
# File 'lib/justcall_ruby/call.rb', line 43
def list(params = {})
params = standardize_body_data(submitted_attrs: params, permitted_attrs: LIST_ATTRS[:permitted])
endpoint = ENDPOINTS[:list] % convert_params_to_request_query(params)
get_request(client: @client, endpoint: endpoint)
end
|
#update(call_id, params) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/justcall_ruby/call.rb', line 57
def update(call_id, params)
endpoint = ENDPOINTS[:update] % call_id
params = standardize_body_data(submitted_attrs: params, permitted_attrs: UPDATE_ATTRS[:permitted])
put_request(client: @client, endpoint: endpoint, data: params)
end
|