Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
3 changes: 3 additions & 0 deletions lib/mindbody-api/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class Base
end

require 'mindbody-api/models/location'
require 'mindbody-api/models/client_credit_card'
require 'mindbody-api/models/relationship'
require 'mindbody-api/models/client_relationship'
require 'mindbody-api/models/client'
require 'mindbody-api/models/schedule_type'
require 'mindbody-api/models/program'
Expand Down
6 changes: 6 additions & 0 deletions lib/mindbody-api/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ class Client < Base
attribute :is_prospect, Boolean
attribute :is_company, Boolean
attribute :notes, String
attribute :emergency_contact_info_phone, String
attribute :emergency_contact_info_name, String
attribute :emergency_contact_info_relationship, String
attribute :emergency_contact_info_email, String
attribute :mobile_phone, String
attribute :home_phone, String
attribute :photo_url, String
attribute :username, String
attribute :first_appointment_date, DateTime
attribute :client_relationships, Array[ClientRelationship]
attribute :client_credit_card, ClientCreditCard

def name
"#{first_name} #{last_name}"
Expand Down
17 changes: 17 additions & 0 deletions lib/mindbody-api/models/client_credit_card.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module MindBody
module Models
class ClientCreditCard < Base
attribute :card_number, String
attribute :card_holder, String
attribute :city, String
attribute :address, String
attribute :state, String
attribute :postal_code, String
attribute :exp_month, String
attribute :exp_year, Integer


end
end
end

11 changes: 11 additions & 0 deletions lib/mindbody-api/models/client_relationship.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module MindBody
module Models
class ClientRelationship < Base
attribute :related_client, Client
attribute :relationship, Relationship
attribute :relationship_name, String

end
end
end

10 changes: 10 additions & 0 deletions lib/mindbody-api/models/relationship.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module MindBody
module Models
class Relationship < Base
attribute :id, Integer
attribute :relationship_name1, String
attribute :relationship_name2, String
end
end
end

12 changes: 12 additions & 0 deletions spec/models/client_credit_card_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe MindBody::Models::ClientCreditCard do
it {should respond_to(:card_number)}
it {should respond_to(:card_holder)}
it {should respond_to(:city)}
it {should respond_to(:address)}
it {should respond_to(:state)}
it {should respond_to(:postal_code)}
it {should respond_to(:exp_month)}
it {should respond_to(:exp_year)}
end
7 changes: 7 additions & 0 deletions spec/models/client_relationship_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe MindBody::Models::ClientRelationship do
it {should respond_to(:related_client)}
it {should respond_to(:relationship)}
it {should respond_to(:relationship_name)}
end
7 changes: 7 additions & 0 deletions spec/models/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@
it {should respond_to(:home_location)}
it {should respond_to(:is_prospect)}
it {should respond_to(:is_company)}
it {should respond_to(:emergency_contact_info_phone)}
it {should respond_to(:emergency_contact_info_name)}
it {should respond_to(:emergency_contact_info_relationship)}
it {should respond_to(:emergency_contact_info_email)}
it {should respond_to(:notes)}
it {should respond_to(:mobile_phone)}
it {should respond_to(:home_phone)}
it {should respond_to(:work_phone)}
it {should respond_to(:photo_url)}
it {should respond_to(:username)}
it {should respond_to(:first_appointment_date)}
it {should respond_to(:client_relationships)}
it {should respond_to(:client_credit_card)}
it {should respond_to(:name)}

it 'should concatenate first_name and last_name to be name' do
Expand Down
7 changes: 7 additions & 0 deletions spec/models/relationship_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe MindBody::Models::Relationship do
it {should respond_to(:id)}
it {should respond_to(:relationship_name1)}
it {should respond_to(:relationship_name2)}
end