Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for customers/phones/create and customers/phones/update

  • Loading branch information...
commit a5e8551ee8ff02241be9bcfa28b302cc77ec7934 1 parent 26b5715
@colinc colinc authored
Showing with 38 additions and 0 deletions.
  1. +38 −0 lib/assistly/client/customer.rb
View
38 lib/assistly/client/customer.rb
@@ -103,6 +103,44 @@ def update_customer_email(id, email_id, *args)
return response
end
end
+
+ # Create a new customer phone number
+ #
+ # @option options [String]
+ # @example Return extended information for 12345
+ # Assistly.create_customer_phone(12345, "555-368-7147")
+ # @format :json
+ # @authenticated true
+ # @see http://dev.desk.com/docs/api/customers/phones/create
+ def create_customer_phone(id, phone, *args)
+ options = args.last.is_a?(Hash) ? args.pop : {}
+ options.merge!({:phone => phone})
+ response = post("customers/#{id}/phones",options)
+ if response['success']
+ return response['results']['phone']
+ else
+ return response
+ end
+ end
+
+ # Update a customer's phone number
+ #
+ # @option options [String]
+ # @example Return extended information for 12345
+ # Assistly.update_customer_phone(12345, 12345, :phone => "555-368-7147")
+ # Assistly.update_customer_phone(12345, 12345, :customer_contact_type => "work")
+ # @format :json
+ # @authenticated true
+ # @see http://dev.desk.com/docs/api/customers/phones/update
+ def update_customer_phone(id, phone_id, *args)
+ options = args.last.is_a?(Hash) ? args.pop : {}
+ response = put("customers/#{id}/phones/#{phone_id}",options)
+ if response['success']
+ return response['results']['phone']
+ else
+ return response
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.