Class: Nylas::Contacts
- Defined in:
- lib/nylas/resources/contacts.rb
Overview
Nylas Contact API
Instance Method Summary collapse
-
#create(identifier:, request_body:) ⇒ Array(Hash, String)
Create a contact.
-
#destroy(identifier:, contact_id:) ⇒ Array(TrueClass, String)
Delete a contact.
-
#find(identifier:, contact_id:, query_params: nil) ⇒ Array(Hash, String)
Return a contact.
-
#list(identifier:, query_params: nil) ⇒ Array(Array(Hash), String, String)
Return all contacts.
-
#list_groups(identifier:, query_params: nil) ⇒ Array(Array(Hash), String, String)
Return all contact groups.
-
#update(identifier:, contact_id:, request_body:) ⇒ Array(Hash, String)
Update a contact.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Nylas::Resource
Instance Method Details
#create(identifier:, request_body:) ⇒ Array(Hash, String)
Create a contact.
44 45 46 47 48 49 |
# File 'lib/nylas/resources/contacts.rb', line 44 def create(identifier:, request_body:) post( path: "#{api_uri}/v3/grants/#{identifier}/contacts", request_body: request_body ) end |
#destroy(identifier:, contact_id:) ⇒ Array(TrueClass, String)
Delete a contact.
69 70 71 72 73 74 75 |
# File 'lib/nylas/resources/contacts.rb', line 69 def destroy(identifier:, contact_id:) _, request_id = delete( path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}" ) [true, request_id] end |
#find(identifier:, contact_id:, query_params: nil) ⇒ Array(Hash, String)
Return a contact.
32 33 34 35 36 37 |
# File 'lib/nylas/resources/contacts.rb', line 32 def find(identifier:, contact_id:, query_params: nil) get( path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}", query_params: query_params ) end |
#list(identifier:, query_params: nil) ⇒ Array(Array(Hash), String, String)
Return all contacts.
19 20 21 22 23 24 |
# File 'lib/nylas/resources/contacts.rb', line 19 def list(identifier:, query_params: nil) get_list( path: "#{api_uri}/v3/grants/#{identifier}/contacts", query_params: query_params ) end |
#list_groups(identifier:, query_params: nil) ⇒ Array(Array(Hash), String, String)
Return all contact groups.
82 83 84 85 86 87 |
# File 'lib/nylas/resources/contacts.rb', line 82 def list_groups(identifier:, query_params: nil) get_list( path: "#{api_uri}/v3/grants/#{identifier}/contacts/groups", query_params: query_params ) end |
#update(identifier:, contact_id:, request_body:) ⇒ Array(Hash, String)
Update a contact.
57 58 59 60 61 62 |
# File 'lib/nylas/resources/contacts.rb', line 57 def update(identifier:, contact_id:, request_body:) put( path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}", request_body: request_body ) end |