Class: SevenApi::Resources::Contacts

Inherits:
SevenApi::Resource show all
Defined in:
lib/seven_api/resources/contacts.rb

Constant Summary

Constants inherited from SevenApi::Resource

SevenApi::Resource::BASE_PATH

Instance Attribute Summary

Attributes inherited from SevenApi::Resource

#api_key, #builder, #conn, #endpoint, #http_methods, #request_methods, #sent_with

Instance Method Summary collapse

Methods inherited from SevenApi::Resource

get_endpoint, get_http_methods, #initialize

Constructor Details

This class inherits a constructor from SevenApi::Resource

Instance Method Details

#all(params = {}) ⇒ Hash

Retrieve contacts associated with the API key read more: docs.seven.io/en/rest-api/endpoints/contacts#query-contact-list

Parameters:

  • params (Hash) (defaults to: {})

Returns:

  • (Hash)


21
22
23
# File 'lib/seven_api/resources/contacts.rb', line 21

def all(params = {})
  request(params)
end

#create(params) ⇒ Hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)


45
46
47
# File 'lib/seven_api/resources/contacts.rb', line 45

def create(params)
  request( params)
end

#delete(id) ⇒ Hash

Delete a contact with given ID read more: docs.seven.io/en/rest-api/endpoints/contacts#delete-contact

Parameters:

  • id (Integer)

Returns:

  • (Hash)


37
38
39
# File 'lib/seven_api/resources/contacts.rb', line 37

def delete(id)
  request({}, {}, "/#{id}")
end

#one(id) ⇒ Hash

Retrieve a contact associated with the API key read more: docs.seven.io/en/rest-api/endpoints/contacts#retrieve-contact

Parameters:

  • id (Int)

Returns:

  • (Hash)


29
30
31
# File 'lib/seven_api/resources/contacts.rb', line 29

def one(id)
  request({}, {}, "/#{id}")
end

#update(contact) ⇒ Hash

Parameters:

  • contact (Hash)

Returns:

  • (Hash)


53
54
55
# File 'lib/seven_api/resources/contacts.rb', line 53

def update(contact)
  request(contact, {}, "/#{contact['id']}")
end