Module: Teamsupport::REST::Customers
Instance Method Summary collapse
-
#create_customer(options = {}) ⇒ Teamsupport::Customer
Create a customer.
-
#customer(id, options = {}) ⇒ Teamsupport::Customer
Returns a customer.
-
#customer_products(id, options = {}) ⇒ Array<Teamsupport::Product>
Returns the products for a customer.
-
#customer_tickets(id, options = {}) ⇒ Array<Teamsupport::Ticket>
Returns the tickets for a customer.
-
#customers(options = {}) ⇒ Array<Teamsupport::Customer>
Returns all available customers for the TeamSupport organization.
-
#delete_customer(id, options = {}) ⇒ Object
Deletes the customer.
-
#update_customer(id, options = {}) ⇒ Teamsupport::Customer
Updates the customer.
Methods included from Utils
Instance Method Details
#create_customer(options = {}) ⇒ Teamsupport::Customer
Create a customer
70 71 72 |
# File 'lib/teamsupport/rest/customers.rb', line 70 def create_customer( = {}) perform_post_with_object_from_collection('/api/json/customers.json', , Teamsupport::Customer, :Customer) end |
#customer(id, options = {}) ⇒ Teamsupport::Customer
Returns a customer
51 52 53 |
# File 'lib/teamsupport/rest/customers.rb', line 51 def customer(id, = {}) perform_get_with_object_from_collection("/api/json/customers/#{id}.json", , Teamsupport::Customer, :Customer) end |
#customer_products(id, options = {}) ⇒ Array<Teamsupport::Product>
Returns the products for a customer
129 130 131 132 |
# File 'lib/teamsupport/rest/customers.rb', line 129 def customer_products(id, = {}) = .dup perform_get_with_objects_from_collection("/api/json/customers/#{id}/products.json", , Teamsupport::CustomerProduct, :OrganizationProducts) end |
#customer_tickets(id, options = {}) ⇒ Array<Teamsupport::Ticket>
Returns the tickets for a customer
150 151 152 153 |
# File 'lib/teamsupport/rest/customers.rb', line 150 def customer_tickets(id, = {}) = .dup perform_get_with_objects_from_collection("/api/json/customers/#{id}/tickets.json", , Teamsupport::Ticket, :Tickets) end |
#customers(options = {}) ⇒ Array<Teamsupport::Customer>
Returns all available customers for the TeamSupport organization
31 32 33 |
# File 'lib/teamsupport/rest/customers.rb', line 31 def customers( = {}) perform_get_with_objects_from_collection('/api/json/customers.json', , Teamsupport::Customer, :Customers) end |
#delete_customer(id, options = {}) ⇒ Object
Deletes the customer
109 110 111 |
# File 'lib/teamsupport/rest/customers.rb', line 109 def delete_customer(id, = {}) perform_delete("/api/json/customers/#{id}.json", ) end |
#update_customer(id, options = {}) ⇒ Teamsupport::Customer
Updates the customer
90 91 92 93 |
# File 'lib/teamsupport/rest/customers.rb', line 90 def update_customer(id, = {}) customer_hash = customer(id).to_h perform_put_with_object_from_collection("/api/json/customers/#{id}.json", customer_hash.merge(), Teamsupport::Customer, :Customer) end |