Class: CheckAppointments::Client
- Inherits:
-
Object
- Object
- CheckAppointments::Client
- Defined in:
- lib/check_appointments/client.rb
Class Method Summary collapse
- .create_signature(body) ⇒ Object
-
.created_on(date) ⇒ Object
Pulls all clients created on specific date.
-
.find_all ⇒ Object
Pulls all clients.
Class Method Details
.create_signature(body) ⇒ Object
3 4 5 |
# File 'lib/check_appointments/client.rb', line 3 def self.create_signature(body) Digest::MD5.hexdigest( body ) end |
.created_on(date) ⇒ Object
Pulls all clients created on specific date. Accepts Date object.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/check_appointments/client.rb', line 22 def self.created_on( date ) date = date.strftime("%Y-%m-%d") api_url = "/rest/clients/createdOn/#{date}" time_stamp = Time.now.utc.to_i sig = create_signature( CheckAppointments.api_key + CheckAppointments.private_key + time_stamp.to_s + api_url ) response = RestClient.get CheckAppointments.base_url + api_url, {:params => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig }} response end |
.find_all ⇒ Object
Pulls all clients
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/check_appointments/client.rb', line 8 def self.find_all api_url = '/rest/clients' time_stamp = Time.now.utc.to_i sig = create_signature( CheckAppointments.api_key + CheckAppointments.private_key + time_stamp.to_s + api_url ) response = RestClient.get CheckAppointments.base_url + api_url, {:params => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig }} response end |