class Alegra::Contacts

Public Instance Methods

create(params) click to toggle source

@param params [ Hash ]

- name [ String ]
- identification [ String ]
- email [ String ]
- phone_primary [ String ]
- phone_secondary [ String ]
- fax [ String ]
- mobile [ String ]
- observations [ String ]
- ignore_repeated [ Boolean ]
- price_list [ Hash ]
- seller [ Hash ]
- term [ Hash ]
- type [ Array ]
- address [ Hash ]
- internal_contacts [ Array ]

@return [ Hash ]

# File lib/alegra/contacts.rb, line 42
def create(params)
  params = params.deep_camel_case_lower_keys
  client.post('contacts', params)
end
delete(id) click to toggle source

@param id [ Integer ] @return [ Hash ]

# File lib/alegra/contacts.rb, line 73
def delete(id)
  client.delete("contacts/#{id}")
end
find(id) click to toggle source

@param id [ Integer ] @return [ Hash ]

# File lib/alegra/contacts.rb, line 5
def find(id)
  client.get("contacts/#{ id }")
end
list(params = {}) click to toggle source

Returs all contacts @param params [ Hash ]

- start [ Integer ]
- limit [ Integer ]
- order_direction [ String ]
- order_field [ string ]
- query [ String ]
- type [ Integer ]
- metadata [ Boolean ]
- name [ String ]
- identification [ String ]

@return [ Array ]

# File lib/alegra/contacts.rb, line 21
def list(params = {})
  client.get('contacts', params)
end
update(id, params) click to toggle source

@param id [ Integer ] @param params [ Hash ]

- name [ String ]
- identification [ String ]
- email [ String ]
- phone_primary [ String ]
- phone_secondary [ String ]
- fax [ String ]
- mobile [ String ]
- observations [ String ]
- ignore_repeated [ Boolean ]
- price_list [ Hash ]
- seller [ Hash ]
- term [ Hash ]
- type [ Array ]
- address [ Hash ]
- internal_contacts [ Array ]

@return [ Hash ]

# File lib/alegra/contacts.rb, line 65
def update(id, params)
  sanitize_params = params.deep_camel_case_lower_keys
  client.put("contacts/#{id}", sanitize_params)

end