Class: Onfleet::Recipients

Inherits:
Object
  • Object
show all
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

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

#match_metadata(config, body) ⇒ Object

ACTION: still needs to be tested



43
44
45
46
47
48
# File 'lib/resources/recipients.rb', line 43

def (config, body)
  method = 'post'
  path = 'recipients/metadata'

  Onfleet.request(config, method.to_sym, path, body.to_json)
end

#update(config, id, body) ⇒ Object



13
14
15
16
17
18
# File 'lib/resources/recipients.rb', line 13

def update(config, id, body)
  method = 'put'
  path = "recipients/#{id}"

  Onfleet.request(config, method.to_sym, path, body.to_json)
end