Class: Quickeebooks::Online::Service::Customer
Constant Summary
Constants inherited
from ServiceBase
ServiceBase::QB_BASE_URI, ServiceBase::XML_NS
Instance Attribute Summary
Attributes inherited from ServiceBase
#base_uri, #oauth, #realm_id
Instance Method Summary
collapse
Methods inherited from ServiceBase
#access_token=, #base_url=, #initialize, #login_name, #url_for_base, #url_for_resource
Instance Method Details
#create(customer) ⇒ Object
#delete(customer) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/quickeebooks/online/service/customer.rb', line 42
def delete(customer)
raise InvalidModelException.new("Missing required parameters for delete") unless customer.valid_for_deletion?
xml = valid_xml_document(customer.to_xml_ns(:fields => ['Id', 'SyncToken']))
url = "#{url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/#{customer.id.value}"
response = do_http_post(url, xml, {:methodx => "delete"})
response.code.to_i == 200
end
|
#fetch_by_id(id) ⇒ Object
#list(filters = [], page = 1, per_page = 20, sort = nil, options = {}) ⇒ Object
50
51
52
|
# File 'lib/quickeebooks/online/service/customer.rb', line 50
def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})
fetch_collection(Quickeebooks::Online::Model::Customer, filters, page, per_page, sort, options)
end
|
#update(customer) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/quickeebooks/online/service/customer.rb', line 30
def update(customer)
raise InvalidModelException.new("Missing required parameters for update") unless customer.valid_for_update?
url = "#{url_for_resource(Quickeebooks::Online::Model::Customer.resource_for_singular)}/#{customer.id.value}"
xml = customer.to_xml_ns
response = do_http_post(url, valid_xml_document(xml))
if response.code.to_i == 200
Quickeebooks::Online::Model::Customer.from_xml(response.body)
else
nil
end
end
|