class FreeAgent::ContactsResource
Public Instance Methods
create(**params)
click to toggle source
# File lib/free_agent/resources/contacts.rb, line 14 def create(**params) raise "first_name and last_name or organisation_name is required" unless !params[:first_name].nil? || !params[:organisation_name].nil? response = post_request("contacts", body: params) Contact.new(response.body["contact"]) if response.success? end
delete(id:)
click to toggle source
# File lib/free_agent/resources/contacts.rb, line 26 def delete(id:) response = delete_request("contacts/#{id}") response.success? end
list(**params)
click to toggle source
# File lib/free_agent/resources/contacts.rb, line 4 def list(**params) response = get_request("contacts", params: params) Collection.from_response(response, type: Contact, key: "contacts") end
retrieve(id:)
click to toggle source
# File lib/free_agent/resources/contacts.rb, line 9 def retrieve(id:) response = get_request("contacts/#{id}") Contact.new(response.body["contact"]) end
update(id:, **params)
click to toggle source
# File lib/free_agent/resources/contacts.rb, line 21 def update(id:, **params) response = put_request("contacts/#{id}", body: params) Contact.new(response.body["contact"]) if response.success? end