Module: VcsClient
- Includes:
- HTTParty
- Defined in:
- lib/vcs_client.rb,
lib/objects/phone.rb,
lib/objects/action.rb,
lib/objects/person.rb,
lib/objects/address.rb,
lib/objects/basement.rb,
lib/objects/reference.rb
Defined Under Namespace
Classes: Action, Address, Basement, CheckinFailed, CheckoutFailed, NoRadius, Person, Phone, Reference, VcsError
Class Method Summary
collapse
Class Method Details
.checkin(campaign_id, client_id, vol_id, token, disposition) ⇒ Object
37
38
39
40
41
|
# File 'lib/vcs_client.rb', line 37
def self.checkin(campaign_id, client_id, vol_id, token, disposition)
result = put("/campaign/#{campaign_id}/client/#{client_id}/volunteer/#{vol_id}/checkout/#{token}", :body => {'disposition' => disposition}, :format => "html")
filter_for_checkin_errors(result)
Crack::JSON.parse(result)
end
|
.checkout(campaign_id, client_id, volunteer_id, lat = nil, long = nil, miles = nil) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/vcs_client.rb', line 19
def self.checkout(campaign_id, client_id, volunteer_id, lat = nil, long = nil, miles = nil)
query_type = 'random'
body = {'queryType' => query_type}
if (!lat.nil? && !long.nil?)
query_type = 'location'
if miles.nil?
raise VcsClient::NoRadius.new("When searching by location a radius is necessary")
end
body = {'queryType' => query_type, 'latitude' => lat, 'longitude' => long, 'miles' => miles}
end
result = post("/campaign/#{campaign_id}/client/#{client_id}/volunteer/#{volunteer_id}/checkout", :body => body)
filter_for_errors(result)
result["people"].inject([]) do |collection, person|
collection << Person.new(person)
end
end
|
.vcs_uri=(uri) ⇒ Object
15
16
17
|
# File 'lib/vcs_client.rb', line 15
def self.vcs_uri=(uri)
base_uri uri
end
|