Class: Voicearchive::CustomerClient

Inherits:
Client
  • Object
show all
Defined in:
lib/voicearchive/customer_client.rb

Instance Attribute Summary

Attributes inherited from Client

#api_key, #version

Instance Method Summary collapse

Methods inherited from Client

#call, #initialize, #set_simple_endpoint_default_values

Constructor Details

This class inherits a constructor from Voicearchive::Client

Instance Method Details

#get_customer(id, params = {}) ⇒ Object



9
10
11
12
13
# File 'lib/voicearchive/customer_client.rb', line 9

def get_customer(id, params={})
  params = set_simple_endpoint_default_values(params)
  response = call("customer/#{id}", params)
  JSON.parse(response.body)
end

#get_customer_contact(customer_id, contact_id, params = {}) ⇒ Object



23
24
25
26
# File 'lib/voicearchive/customer_client.rb', line 23

def get_customer_contact(customer_id, contact_id, params={})
  response = call("customer/#{customer_id}/contacts/#{contact_id}", params)
  JSON.parse(response.body)
end

#get_customer_contacts(id, params = {}) ⇒ Object



18
19
20
21
22
# File 'lib/voicearchive/customer_client.rb', line 18

def get_customer_contacts(id, params={})
  params = set_simple_endpoint_default_values(params)
  response = call("customer/#{id}/contacts", params)
  JSON.parse(response.body)
end

#get_customers(params = {}) ⇒ Object



4
5
6
7
8
# File 'lib/voicearchive/customer_client.rb', line 4

def get_customers(params={})
  params = set_simple_endpoint_default_values(params)
  response = call('customer', params)
  JSON.parse(response.body)
end

#update_customer(id, params = {}) ⇒ Object



14
15
16
17
# File 'lib/voicearchive/customer_client.rb', line 14

def update_customer(id, params = {})
  response = call("customer/#{id}", params, "put")
  JSON.parse(response.body)
end

#update_customer_contact(customer_id, contact_id, params = {}) ⇒ Object



27
28
29
30
# File 'lib/voicearchive/customer_client.rb', line 27

def update_customer_contact(customer_id, contact_id, params={})
  response = call("customer/#{customer_id}/contacts/#{contact_id}", params, "put")
  JSON.parse(response.body)
end