Class: Onfleet::Recipients
- Inherits:
-
Object
- Object
- Onfleet::Recipients
- Defined in:
- lib/resources/recipients.rb
Overview
A recipient is an organization’s customer and a target for a task, that is, whom the task is being delivered to.
Instance Method Summary collapse
- #create(config, body) ⇒ Object
- #get(config, id) ⇒ Object
- #get_by_name(config, recipient_name) ⇒ Object
- #get_by_phone(config, recipient_phone) ⇒ Object
-
#match_metadata(config, body) ⇒ Object
ACTION: still needs to be tested.
- #update(config, id, body) ⇒ Object
Instance Method Details
#create(config, body) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/resources/recipients.rb', line 6 def create(config, body) method = 'post' path = 'recipients' Onfleet.request(config, method.to_sym, path, body.to_json) end |
#get(config, id) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/resources/recipients.rb', line 20 def get(config, id) method = 'get' path = "recipients/#{id}" Onfleet.request(config, method.to_sym, path) end |
#get_by_name(config, recipient_name) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/resources/recipients.rb', line 27 def get_by_name(config, recipient_name) method = 'get' recipient_name.gsub!(/\s+/, '%20') path = "recipients/name/#{recipient_name}" Onfleet.request(config, method.to_sym, path) end |
#get_by_phone(config, recipient_phone) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/resources/recipients.rb', line 35 def get_by_phone(config, recipient_phone) method = 'get' path = "recipients/phone/#{recipient_phone}" Onfleet.request(config, method.to_sym, path) end |