check_appointments 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc7faadf375eb09098be4c19caaec7030224d0b6
4
+ data.tar.gz: 1a37ee4e6057ce6f98f12868babffb7cac5f52bf
5
+ SHA512:
6
+ metadata.gz: 8705555532fcf964966b5c8283c1e6a6f13a5535818b6b02142da864b9d077054ff81dbdf935b3ca6da45107c80775c342e92a905fd5981f2c8a2a981228aa0a
7
+ data.tar.gz: 49efaf3d9c55a27044b68fa4adc708bf9c7365fcd8fb3f45eca8344f12928b2ec61b7d67f80850852fbd5f33b7ea4a2d7eccd4bd7c02aff8e6adcc2483a1cc85
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in check_appointments.gemspec
5
+ gemspec
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,31 @@
1
+ module CheckAppointments
2
+ class Appointment
3
+ def self.create_signature(body)
4
+ Digest::MD5.hexdigest( body )
5
+ end
6
+
7
+ # Returns array of :
8
+ # {"calendarId"=>int, "businessId"=>int, "date"=>"2014-02-11", "startTime"=>int, "endTime"=>int,
9
+ # "staffTimeText"=>"Tuesday, Feb 11, 2014 at 6:00 PM EST", "client"=>{"clientId"=>int, "fullName"=>string,
10
+ # "firstName"=>string, "lastName"=>string, "dateOfBirth"=>string, "sex"=>string, "ssn"=>string, "emailAddress"=>string,
11
+ # "address1"=>string, "address2"=>string, "city"=>string, "county"=>string, "state"=>string, "zip"=>string, "country"=>string,
12
+ # "homePhone"=>string, "cellPhone"=>string, "createdDate"=>"2013-10-16 18:20:38"}, "staff"=>{"professionalId"=>int,
13
+ # "fullName"=>string, "userName"=>string, "email"=>string, "phone"=>string, "active"=>boolean, "acceptAppointments"=>boolean,
14
+ # "businessId"=>int}, "location"=>{"locationId"=>int, "locationName"=>string, "businessId"=>int, "active"=>boolean,
15
+ # "address1"=>string, "address2"=>string, "city"=>string, "state"=>string, "zip"=>string, "country"=>string}}
16
+ def self.find_all
17
+ api_url = "/rest/appointments/#{CheckAppointments.api_key}/all/all"
18
+ time_stamp = Time.now.utc.to_i
19
+ sig = create_signature( CheckAppointments.api_key + CheckAppointments.private_key + time_stamp.to_s + api_url )
20
+ # response = RestClient.get CheckAppointments.base_url + api_url ,
21
+ # {:params => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig }}
22
+ response = RestClient::Request.execute :method => :get, :url => CheckAppointments.base_url + api_url, :payload => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig}, :ssl_version => 'TLSv1'
23
+
24
+ appointments = JSON.parse(response)
25
+ response = []
26
+ appointments.each { |appointment| response << appointment }
27
+
28
+ response
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ module CheckAppointments
2
+ class Client
3
+ def self.create_signature(body)
4
+ Digest::MD5.hexdigest( body )
5
+ end
6
+
7
+ #Pulls all clients
8
+ def self.find_all
9
+ api_url = '/rest/clients'
10
+ time_stamp = Time.now.utc.to_i
11
+ sig = create_signature( CheckAppointments.api_key + CheckAppointments.private_key + time_stamp.to_s + api_url )
12
+ # response = RestClient.get CheckAppointments.base_url + api_url,
13
+ # {:params => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig }}
14
+ response = RestClient::Request.execute :method => :get, :url => CheckAppointments.base_url + api_url, :payload => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig}, :ssl_version => 'TLSv1'
15
+ response
16
+ end
17
+
18
+ # Pulls all clients created on specific date. Accepts Date object.
19
+ def self.created_on( date )
20
+ date = date.strftime("%Y-%m-%d")
21
+ api_url = "/rest/clients/createdOn/#{date}"
22
+ time_stamp = Time.now.utc.to_i
23
+ sig = create_signature( CheckAppointments.api_key + CheckAppointments.private_key + time_stamp.to_s + api_url )
24
+ # response = RestClient.get CheckAppointments.base_url + api_url,
25
+ # {:params => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig }}
26
+ response = RestClient::Request.execute :method => :get, :url => CheckAppointments.base_url + api_url, :payload => {:apiKey => CheckAppointments.api_key, :timestamp => time_stamp, :signature => sig}, :ssl_version => 'TLSv1'
27
+ response
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module CheckAppointments
2
+ module Configuration
3
+ # The list of available options
4
+ VALID_OPTION_KEYS = [
5
+ :api_key,
6
+ :private_key,
7
+ :base_url
8
+ ].freeze
9
+
10
+ # @private
11
+ attr_accessor *VALID_OPTION_KEYS
12
+
13
+ # When this module is extended, set all configuration options to their default values
14
+ #def self.extended(base)
15
+ #base.reset
16
+ #end
17
+
18
+ # Convenience method to allow configuration options to be set in a block
19
+ def configure
20
+ yield self
21
+ end
22
+
23
+ # Create a hash of options and their values
24
+ def options
25
+ options = {}
26
+ VALID_OPTION_KEYS.each{|k| options[k] = send(k)}
27
+ options
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,11 @@
1
+ module CheckAppointments
2
+ require 'rest_client'
3
+ require 'mime-types'
4
+ require 'rdoc'
5
+ require 'JSON'
6
+ require 'check_appointments/client.rb'
7
+ require 'check_appointments/appointments.rb'
8
+ require 'check_appointments/configuration.rb'
9
+
10
+ extend Configuration
11
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: check_appointments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Travis Sperry
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: tsperry1@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - Gemfile
20
+ - README.md
21
+ - Rakefile
22
+ - lib/check_appointments.rb
23
+ - lib/check_appointments/appointments.rb
24
+ - lib/check_appointments/client.rb
25
+ - lib/check_appointments/configuration.rb
26
+ homepage:
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.2.2
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Gem that interfaces with the CheckAppointments API
50
+ test_files: []