Class: Starling::Services::ContactAccountsService
- Inherits:
-
BaseService
- Object
- BaseService
- Starling::Services::ContactAccountsService
- Defined in:
- lib/starling/services/contact_accounts_service.rb
Overview
A service for accessing the Contact API’s Get Contact Accounts and Get Contact endpoints
Instance Method Summary collapse
- #get(contact_id, contact_account_id, params: {}, headers: {}) ⇒ Resources::ContactAccountResource
- #list(contact_id, params: {}, headers: {}) ⇒ Array<Resources::ContactAccountResource>
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Starling::Services::BaseService
Instance Method Details
#get(contact_id, contact_account_id, params: {}, headers: {}) ⇒ Resources::ContactAccountResource
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/starling/services/contact_accounts_service.rb', line 17 def get(contact_id, contact_account_id, params: {}, headers: {}) response = api_service.make_request( :get, "/contacts/#{contact_id}/accounts/#{contact_account_id}", params: params, headers: headers ) resource.new(response: response) end |
#list(contact_id, params: {}, headers: {}) ⇒ Array<Resources::ContactAccountResource>
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/starling/services/contact_accounts_service.rb', line 36 def list(contact_id, params: {}, headers: {}) response = api_service.make_request( :get, "/contacts/#{contact_id}/accounts", params: params, headers: headers ) build_collection_from_key(response, key: 'contactAccounts', resource: resource) end |