mindbody-api 1.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +5 -0
  4. data/CONTRIBUTING.md +16 -0
  5. data/Gemfile +12 -0
  6. data/Guardfile +6 -0
  7. data/LICENSE.md +22 -0
  8. data/README.md +79 -0
  9. data/Rakefile +52 -0
  10. data/lib/mindbody-api.rb +35 -0
  11. data/lib/mindbody-api/api_status.rb +109 -0
  12. data/lib/mindbody-api/client.rb +39 -0
  13. data/lib/mindbody-api/ext/savon_ext.rb +53 -0
  14. data/lib/mindbody-api/models.rb +34 -0
  15. data/lib/mindbody-api/models/appointment.rb +22 -0
  16. data/lib/mindbody-api/models/appointment_status.rb +13 -0
  17. data/lib/mindbody-api/models/availability.rb +11 -0
  18. data/lib/mindbody-api/models/class.rb +31 -0
  19. data/lib/mindbody-api/models/class_description.rb +14 -0
  20. data/lib/mindbody-api/models/class_schedule.rb +26 -0
  21. data/lib/mindbody-api/models/client.rb +32 -0
  22. data/lib/mindbody-api/models/client_service.rb +16 -0
  23. data/lib/mindbody-api/models/course.rb +16 -0
  24. data/lib/mindbody-api/models/level.rb +8 -0
  25. data/lib/mindbody-api/models/location.rb +38 -0
  26. data/lib/mindbody-api/models/payment.rb +11 -0
  27. data/lib/mindbody-api/models/program.rb +9 -0
  28. data/lib/mindbody-api/models/resource.rb +8 -0
  29. data/lib/mindbody-api/models/sale.rb +10 -0
  30. data/lib/mindbody-api/models/sale_item.rb +14 -0
  31. data/lib/mindbody-api/models/schedule_type.rb +13 -0
  32. data/lib/mindbody-api/models/semester.rb +9 -0
  33. data/lib/mindbody-api/models/service.rb +13 -0
  34. data/lib/mindbody-api/models/session_type.rb +8 -0
  35. data/lib/mindbody-api/models/site.rb +23 -0
  36. data/lib/mindbody-api/models/staff.rb +32 -0
  37. data/lib/mindbody-api/models/unavailability.rb +7 -0
  38. data/lib/mindbody-api/models/visit.rb +19 -0
  39. data/lib/mindbody-api/response.rb +119 -0
  40. data/lib/mindbody-api/service.rb +39 -0
  41. data/lib/mindbody-api/services/appointment_service.rb +15 -0
  42. data/lib/mindbody-api/services/class_service.rb +12 -0
  43. data/lib/mindbody-api/services/client_service.rb +30 -0
  44. data/lib/mindbody-api/services/finder_service.rb +11 -0
  45. data/lib/mindbody-api/services/sale_service.rb +14 -0
  46. data/lib/mindbody-api/services/site_service.rb +15 -0
  47. data/lib/mindbody-api/services/staff_service.rb +12 -0
  48. data/lib/mindbody-api/version.rb +4 -0
  49. data/mindbody-api.gemspec +29 -0
  50. data/spec/api_status_spec.rb +110 -0
  51. data/spec/client_spec.rb +51 -0
  52. data/spec/fixtures/wsdl/geotrust.wsdl +156 -0
  53. data/spec/mindbody_spec.rb +79 -0
  54. data/spec/model_spec.rb +7 -0
  55. data/spec/models/appointment_spec.rb +18 -0
  56. data/spec/models/appointment_status_spec.rb +17 -0
  57. data/spec/models/availability.rb +8 -0
  58. data/spec/models/class_description_spec.rb +12 -0
  59. data/spec/models/class_schedule_spec.rb +24 -0
  60. data/spec/models/class_spec.rb +39 -0
  61. data/spec/models/client_service_spec.rb +13 -0
  62. data/spec/models/client_spec.rb +33 -0
  63. data/spec/models/course_spec.rb +14 -0
  64. data/spec/models/level_spec.rb +6 -0
  65. data/spec/models/location_spec.rb +34 -0
  66. data/spec/models/payment_spec.rb +9 -0
  67. data/spec/models/program_spec.rb +7 -0
  68. data/spec/models/resource_spec.rb +6 -0
  69. data/spec/models/sale_item_spec.rb +12 -0
  70. data/spec/models/sale_spec.rb +8 -0
  71. data/spec/models/schedule_type_spec.rb +17 -0
  72. data/spec/models/semester_spec.rb +7 -0
  73. data/spec/models/service_spec.rb +11 -0
  74. data/spec/models/session_type_spec.rb +6 -0
  75. data/spec/models/site_spec.rb +31 -0
  76. data/spec/models/staff_spec.rb +29 -0
  77. data/spec/models/unavailability.rb +5 -0
  78. data/spec/models/visit_spec.rb +16 -0
  79. data/spec/response_spec.rb +115 -0
  80. data/spec/service_spec.rb +106 -0
  81. data/spec/services/appointment_service_spec.rb +13 -0
  82. data/spec/services/class_service_spec.rb +10 -0
  83. data/spec/services/client_service_spec.rb +27 -0
  84. data/spec/services/finder_service_spec.rb +9 -0
  85. data/spec/services/sale_service_spec.rb +12 -0
  86. data/spec/services/site_service_spec.rb +13 -0
  87. data/spec/services/staff_service_spec.rb +10 -0
  88. data/spec/spec_helper.rb +18 -0
  89. data/wsdl/AppointmentService.wsdl +1084 -0
  90. data/wsdl/ClassService.wsdl +1656 -0
  91. data/wsdl/ClientService.wsdl +2295 -0
  92. data/wsdl/FinderService.wsdl +1427 -0
  93. data/wsdl/SaleService.wsdl +1678 -0
  94. data/wsdl/SiteService.wsdl +915 -0
  95. data/wsdl/StaffService.wsdl +939 -0
  96. metadata +277 -0
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Services::Client do
4
+ before do
5
+ creds = double('credentials')
6
+ creds.stub(:log_level).and_return(:debug)
7
+ creds.stub(:source_name).and_return('test')
8
+ creds.stub(:source_key).and_return('test_key')
9
+ creds.stub(:site_ids).and_return([-99])
10
+ creds.stub(:open_timeout).and_return(0)
11
+ creds.stub(:read_timeout).and_return(0)
12
+ MindBody.stub(:configuration).and_return(creds)
13
+ @client = MindBody::Services::Client.new(:wsdl => 'spec/fixtures/wsdl/geotrust.wsdl')
14
+
15
+ resp = double('response')
16
+ resp.stub(:http)
17
+ Savon::Operation.any_instance.stub(:call).and_return(resp)
18
+ MindBody::Services::Response.any_instance.stub(:normalize_response)
19
+ MindBody::Services::Response.any_instance.stub(:error_code).and_return(200)
20
+ MindBody::Services::Response.any_instance.stub(:status).and_return('Success')
21
+ end
22
+
23
+ subject { @client }
24
+
25
+ describe '#call' do
26
+ before :each do
27
+ @locals = { :message => { 'Request' => {
28
+ 'SourceCredentials' => {
29
+ 'SourceName' => 'test',
30
+ 'Password' => 'test_key',
31
+ 'SiteIDs' => {'int' => [-99]}
32
+ }
33
+ }}}
34
+ end
35
+ it 'should inject the auth params' do
36
+ Savon::Operation.any_instance.should_receive(:call).once.with(@locals)
37
+ subject.call(:hello)
38
+ end
39
+
40
+ it 'should correctly map Arrays to be int lists' do
41
+ locals = @locals.dup
42
+ locals[:message]['Request'].merge!({:site_ids => {'int' => [1,2,3,4]}})
43
+ Savon::Operation.any_instance.should_receive(:call).once.with(locals)
44
+ subject.call(:hello, :site_ids => [1,2,3,4])
45
+ end
46
+
47
+ it 'should return a MindBody::Services::Response object' do
48
+ expect(subject.call(:hello)).to be_kind_of(MindBody::Services::Response)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,156 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <s0:definitions name="queryDefinitions" targetNamespace="http://api.geotrust.com/webtrust/query" xmlns="" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://api.geotrust.com/webtrust/query" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s3="http://www.openuri.org/2006/12/wsdl/upgradedJWS">
3
+ <s0:types>
4
+ <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://api.geotrust.com/webtrust/query" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://api.geotrust.com/webtrust/query" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s3="http://www.openuri.org/2006/12/wsdl/upgradedJWS" xmlns:xs="http://www.w3.org/2001/XMLSchema">
5
+ <xs:complexType name="GetQuickApproverListInput">
6
+ <xs:sequence>
7
+ <xs:element minOccurs="0" name="QueryRequestHeader" type="quer:queryRequestHeader" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
8
+ <xs:element minOccurs="0" name="Domain" type="xs:string"/>
9
+ <xs:element minOccurs="0" name="IncludeUserAgreement" type="quer:includeUserAgreement" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
10
+ </xs:sequence>
11
+ </xs:complexType>
12
+ <xs:complexType name="queryRequestHeader">
13
+ <xs:sequence>
14
+ <xs:element minOccurs="0" name="PartnerCode" type="xs:string"/>
15
+ <xs:element minOccurs="0" name="AuthToken" type="quer:authToken" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
16
+ <xs:element minOccurs="0" name="ReplayToken" type="xs:string"/>
17
+ <xs:element minOccurs="0" name="UseReplayToken" type="xs:boolean"/>
18
+ </xs:sequence>
19
+ </xs:complexType>
20
+ <xs:complexType name="authToken">
21
+ <xs:sequence>
22
+ <xs:element minOccurs="0" name="UserName" type="xs:string"/>
23
+ <xs:element minOccurs="0" name="Password" type="xs:string"/>
24
+ </xs:sequence>
25
+ </xs:complexType>
26
+ <xs:complexType name="includeUserAgreement">
27
+ <xs:sequence>
28
+ <xs:element minOccurs="0" name="UserAgreementProductCode" type="xs:string"/>
29
+ </xs:sequence>
30
+ </xs:complexType>
31
+ <xs:complexType name="GetUserAgreementInput">
32
+ <xs:sequence>
33
+ <xs:element minOccurs="0" name="QueryRequestHeader" type="quer:queryRequestHeader" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
34
+ <xs:element minOccurs="0" name="UserAgreementProductCode" type="xs:string"/>
35
+ </xs:sequence>
36
+ </xs:complexType>
37
+ <xs:complexType name="GetQuickApproverListOutput">
38
+ <xs:sequence>
39
+ <xs:element minOccurs="0" name="QueryResponseHeader" type="quer:queryResponseHeader" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
40
+ <xs:element minOccurs="0" name="ApproverList" type="quer:ArrayOfApprover" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
41
+ <xs:element minOccurs="0" name="UserAgreement" type="xs:string"/>
42
+ </xs:sequence>
43
+ </xs:complexType>
44
+ <xs:complexType name="queryResponseHeader">
45
+ <xs:sequence>
46
+ <xs:element name="SuccessCode" type="xs:int"/>
47
+ <xs:element minOccurs="0" name="Errors" type="quer:ArrayOfError" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
48
+ <xs:element minOccurs="0" name="Timestamp" type="xs:dateTime"/>
49
+ <xs:element name="ReturnCount" type="xs:int"/>
50
+ </xs:sequence>
51
+ </xs:complexType>
52
+ <xs:complexType name="Error">
53
+ <xs:sequence>
54
+ <xs:element name="ErrorCode" type="xs:int"/>
55
+ <xs:element minOccurs="0" name="ErrorField" type="xs:string"/>
56
+ <xs:element minOccurs="0" name="ErrorMessage" type="xs:string"/>
57
+ </xs:sequence>
58
+ </xs:complexType>
59
+ <xs:complexType name="ArrayOfError">
60
+ <xs:sequence>
61
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="Error" type="quer:Error" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
62
+ </xs:sequence>
63
+ </xs:complexType>
64
+ <xs:element name="ArrayOfError" type="quer:ArrayOfError" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
65
+ <xs:complexType name="Approver">
66
+ <xs:sequence>
67
+ <xs:element minOccurs="0" name="ApproverType" type="xs:string"/>
68
+ <xs:element minOccurs="0" name="ApproverEmail" type="xs:string"/>
69
+ </xs:sequence>
70
+ </xs:complexType>
71
+ <xs:complexType name="ArrayOfApprover">
72
+ <xs:sequence>
73
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="Approver" type="quer:Approver" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
74
+ </xs:sequence>
75
+ </xs:complexType>
76
+ <xs:element name="ArrayOfApprover" type="quer:ArrayOfApprover" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
77
+ <xs:complexType name="ArrayOfString">
78
+ <xs:sequence>
79
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="String" type="xs:string"/>
80
+ </xs:sequence>
81
+ </xs:complexType>
82
+ <xs:element name="ArrayOfString" type="quer:ArrayOfString" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
83
+ <xs:element name="GetQuickApproverList">
84
+ <xs:complexType>
85
+ <xs:sequence>
86
+ <xs:element minOccurs="0" name="Request" type="quer:GetQuickApproverListInput" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
87
+ </xs:sequence>
88
+ </xs:complexType>
89
+ </xs:element>
90
+ <xs:element name="GetQuickApproverListResponse">
91
+ <xs:complexType>
92
+ <xs:sequence>
93
+ <xs:element minOccurs="0" name="GetQuickApproverListResult" type="quer:GetQuickApproverListOutput" xmlns:quer="http://api.geotrust.com/webtrust/query"/>
94
+ </xs:sequence>
95
+ </xs:complexType>
96
+ </xs:element>
97
+ <xs:element name="hello">
98
+ <xs:complexType>
99
+ <xs:sequence>
100
+ <xs:element minOccurs="0" name="Input" type="xs:string"/>
101
+ </xs:sequence>
102
+ </xs:complexType>
103
+ </xs:element>
104
+ <xs:element name="helloResponse">
105
+ <xs:complexType>
106
+ <xs:sequence>
107
+ <xs:element minOccurs="0" name="helloResult" type="xs:string"/>
108
+ </xs:sequence>
109
+ </xs:complexType>
110
+ </xs:element>
111
+ </xs:schema>
112
+ </s0:types>
113
+ <s0:message name="hello">
114
+ <s0:part element="s1:hello" name="parameters"/>
115
+ </s0:message>
116
+ <s0:message name="helloResponse">
117
+ <s0:part element="s1:helloResponse" name="helloResultPart"/>
118
+ </s0:message>
119
+ <s0:portType name="querySoap">
120
+ <s0:operation name="GetQuickApproverList" parameterOrder="parameters">
121
+ <s0:input message="s1:GetQuickApproverList"/>
122
+ <s0:output message="s1:GetQuickApproverListResponse"/>
123
+ </s0:operation>
124
+ <s0:operation name="hello" parameterOrder="parameters">
125
+ <s0:input message="s1:hello"/>
126
+ <s0:output message="s1:helloResponse"/>
127
+ </s0:operation>
128
+ </s0:portType>
129
+ <s0:binding name="querySoapBinding" type="s1:querySoap">
130
+ <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
131
+ <s0:operation name="GetQuickApproverList">
132
+ <s2:operation style="document"/>
133
+ <s0:input>
134
+ <s2:body parts="parameters" use="literal"/>
135
+ </s0:input>
136
+ <s0:output>
137
+ <s2:body parts="GetQuickApproverListResultPart" use="literal"/>
138
+ </s0:output>
139
+ </s0:operation>
140
+ <s0:operation name="hello">
141
+ <s2:operation style="document"/>
142
+ <s0:input>
143
+ <s2:body parts="parameters" use="literal"/>
144
+ </s0:input>
145
+ <s0:output>
146
+ <s2:body parts="helloResultPart" use="literal"/>
147
+ </s0:output>
148
+ </s0:operation>
149
+ </s0:binding>
150
+ <s0:service name="query">
151
+ <s3:upgraded81/>
152
+ <s0:port binding="s1:querySoapBinding" name="querySoap">
153
+ <s2:address location="https://test-api.geotrust.com:443/webtrust/query.jws"/>
154
+ </s0:port>
155
+ </s0:service>
156
+ </s0:definitions>
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody do
4
+ describe '#configuration' do
5
+ subject { MindBody.configuration }
6
+
7
+ it { should_not be_nil }
8
+ it { should be_an_instance_of(MindBody::Config) }
9
+ end
10
+
11
+ describe '#configure' do
12
+ it 'yields to the configuration object' do
13
+ yielded_object = nil
14
+ MindBody.configure do |config|
15
+ yielded_object = config
16
+ end
17
+ expect(yielded_object).to be MindBody.configuration
18
+ end
19
+ end
20
+ end
21
+
22
+ describe MindBody::Config do
23
+ before :each do
24
+ @config = MindBody::Config.new
25
+ end
26
+
27
+ subject { @config }
28
+
29
+ context 'an instance' do
30
+ it { should respond_to(:source_name) }
31
+ it { should respond_to(:source_key) }
32
+ it { should respond_to(:site_ids) }
33
+ end
34
+
35
+ describe '#new' do
36
+ it { should_not be_nil }
37
+
38
+ it 'should have default values' do
39
+ expect(@config.source_name).to eq('')
40
+ expect(@config.source_key).to eq('')
41
+ expect(@config.site_ids).to eq([])
42
+ end
43
+
44
+ it 'should load config data from ENV' do
45
+ ENV['MINDBODY_SOURCE_NAME'] = 'test'
46
+ ENV['MINDBODY_SOURCE_KEY'] = 'key1234'
47
+ ENV['MINDBODY_SITE_IDS'] = '1,2,3,-4'
48
+
49
+ @config = MindBody::Config.new
50
+ expect(@config.source_name).to eq('test')
51
+ expect(@config.source_key).to eq('key1234')
52
+ expect(@config.site_ids).to eq([1,2,3,-4])
53
+ end
54
+
55
+ it 'should allow arbitrary delimiters for MINDBODY_SITE_IDS' do
56
+ ENV['MINDBODY_SITE_IDS'] = '1 2 3 -4'
57
+ @config = MindBody::Config.new
58
+ expect(@config.site_ids).to eq([1,2,3,-4])
59
+
60
+ ENV['MINDBODY_SITE_IDS'] = '1;2;3;-4'
61
+ @config = MindBody::Config.new
62
+ expect(@config.site_ids).to eq([1,2,3,-4])
63
+
64
+ ENV['MINDBODY_SITE_IDS'] = '1:2:3:-4'
65
+ @config = MindBody::Config.new
66
+ expect(@config.site_ids).to eq([1,2,3,-4])
67
+ end
68
+ end
69
+
70
+ describe '#site_ids=' do
71
+ it 'should wrap all input into an array' do
72
+ @config.site_ids = 5
73
+ expect(@config.site_ids).to eq([5])
74
+
75
+ @config.site_ids = [3,4]
76
+ expect(@config.site_ids).to eq([3,4])
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::Base do
4
+ subject { MindBody::Models::Base }
5
+
6
+ it { should respond_to(:attribute) }
7
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::Appointment do
4
+ it { should respond_to(:id) }
5
+ it { should respond_to(:status) }
6
+ it { should respond_to(:start_date_time) }
7
+ it { should respond_to(:end_date_time) }
8
+ it { should respond_to(:notes) }
9
+ it { should respond_to(:staff_requested) }
10
+ it { should respond_to(:program) }
11
+ it { should respond_to(:session_type) }
12
+ it { should respond_to(:location) }
13
+ it { should respond_to(:staff) }
14
+ it { should respond_to(:client) }
15
+ it { should respond_to(:first_appointment) }
16
+ it { should respond_to(:client_service) }
17
+ it { should respond_to(:resources) }
18
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::AppointmentStatus do
4
+ context 'with an invalid status' do
5
+ before { @status = MindBody::Models::AppointmentStatus.new('invalid') }
6
+ subject { @status }
7
+
8
+ its(:status) { should be_nil }
9
+ end
10
+
11
+ context 'with a valid status' do
12
+ before { @status = MindBody::Models::AppointmentStatus.new('Booked') }
13
+ subject { @status }
14
+
15
+ its(:status) { should eql('Booked') }
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::Availability do
4
+ it { should respond_to(:location_id) }
5
+ it { should respond_to(:start_date_time) }
6
+ it { should respond_to(:end_date_time) }
7
+ it { should respond_to(:unavailable_description) }
8
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::ClassDescription do
4
+ it { should respond_to(:level) }
5
+ it { should respond_to(:id) }
6
+ it { should respond_to(:name) }
7
+ it { should respond_to(:description) }
8
+ it { should respond_to(:notes) }
9
+ it { should respond_to(:last_updated) }
10
+ it { should respond_to(:program) }
11
+ it { should respond_to(:session_type) }
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::ClassSchedule do
4
+ it { should respond_to(:id) }
5
+ it { should respond_to(:classes) }
6
+ it { should respond_to(:clients) }
7
+ it { should respond_to(:course) }
8
+ it { should respond_to(:semester_id) }
9
+ it { should respond_to(:is_available) }
10
+ it { should respond_to(:class_description) }
11
+ it { should respond_to(:day_sunday) }
12
+ it { should respond_to(:day_monday) }
13
+ it { should respond_to(:day_tuesday) }
14
+ it { should respond_to(:day_wednesday) }
15
+ it { should respond_to(:day_thursday) }
16
+ it { should respond_to(:day_friday) }
17
+ it { should respond_to(:day_saturday) }
18
+ it { should respond_to(:start_time) }
19
+ it { should respond_to(:end_time) }
20
+ it { should respond_to(:start_date) }
21
+ it { should respond_to(:end_date) }
22
+ it { should respond_to(:staff) }
23
+ it { should respond_to(:location) }
24
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::Class do
4
+ before do
5
+ des = double('class_description')
6
+ des.stub(:name).and_return('foo')
7
+ des.stub(:to_hash).and_return({:name => 'foo'})
8
+ @klass = MindBody::Models::Class.new(:class_description => des)
9
+ end
10
+
11
+ subject { @klass }
12
+
13
+ it { should respond_to(:id) }
14
+ it { should respond_to(:class_schedule_id) }
15
+ it { should respond_to(:visits) }
16
+ it { should respond_to(:clients) }
17
+ it { should respond_to(:location) }
18
+ it { should respond_to(:max_capacity) }
19
+ it { should respond_to(:web_capacity) }
20
+ it { should respond_to(:total_booked) }
21
+ it { should respond_to(:web_booked) }
22
+ it { should respond_to(:semester_id) }
23
+ it { should respond_to(:is_canceled) }
24
+ it { should respond_to(:substitute) }
25
+ it { should respond_to(:active) }
26
+ it { should respond_to(:is_waitlist_available) }
27
+ it { should respond_to(:is_enrolled) }
28
+ it { should respond_to(:hide_cancel) }
29
+ it { should respond_to(:is_available) }
30
+ it { should respond_to(:start_date_time) }
31
+ it { should respond_to(:end_date_time) }
32
+ it { should respond_to(:class_description) }
33
+ it { should respond_to(:staff) }
34
+ it { should respond_to(:name) }
35
+
36
+ it 'should delegate name to the class_description name' do
37
+ expect(subject.name).to eql(subject.class_description.name)
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::ClientService do
4
+ it { should respond_to(:id) }
5
+ it { should respond_to(:current) }
6
+ it { should respond_to(:count) }
7
+ it { should respond_to(:remaining) }
8
+ it { should respond_to(:name) }
9
+ it { should respond_to(:payment_date) }
10
+ it { should respond_to(:active_date) }
11
+ it { should respond_to(:expiration_date) }
12
+ it { should respond_to(:program) }
13
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe MindBody::Models::Client do
4
+ it {should respond_to(:id)}
5
+ it {should respond_to(:first_name)}
6
+ it {should respond_to(:last_name)}
7
+ it {should respond_to(:gender)}
8
+ it {should respond_to(:email)}
9
+ it {should respond_to(:email_opt_in)}
10
+ it {should respond_to(:address_line1)}
11
+ it {should respond_to(:address_line2)}
12
+ it {should respond_to(:city)}
13
+ it {should respond_to(:state)}
14
+ it {should respond_to(:postal_code)}
15
+ it {should respond_to(:country)}
16
+ it {should respond_to(:birth_date)}
17
+ it {should respond_to(:home_location)}
18
+ it {should respond_to(:is_prospect)}
19
+ it {should respond_to(:is_company)}
20
+ it {should respond_to(:notes)}
21
+ it {should respond_to(:mobile_phone)}
22
+ it {should respond_to(:home_phone)}
23
+ it {should respond_to(:photo_url)}
24
+ it {should respond_to(:username)}
25
+ it {should respond_to(:first_appointment_date)}
26
+ it {should respond_to(:name)}
27
+
28
+ it 'should concatenate first_name and last_name to be name' do
29
+ subject.first_name = "Bob"
30
+ subject.last_name = "Dole"
31
+ expect(subject.name).to eql("Bob Dole")
32
+ end
33
+ end