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,34 @@
1
+ require 'virtus'
2
+
3
+ module MindBody
4
+ module Models
5
+ class Base
6
+ include Virtus.model
7
+ end
8
+ end
9
+ end
10
+
11
+ require 'mindbody-api/models/location'
12
+ require 'mindbody-api/models/client'
13
+ require 'mindbody-api/models/schedule_type'
14
+ require 'mindbody-api/models/program'
15
+ require 'mindbody-api/models/client_service'
16
+ require 'mindbody-api/models/site'
17
+ require 'mindbody-api/models/availability'
18
+ require 'mindbody-api/models/unavailability'
19
+ require 'mindbody-api/models/staff'
20
+ require 'mindbody-api/models/visit'
21
+ require 'mindbody-api/models/semester'
22
+ require 'mindbody-api/models/course'
23
+ require 'mindbody-api/models/level'
24
+ require 'mindbody-api/models/session_type'
25
+ require 'mindbody-api/models/class_description'
26
+ require 'mindbody-api/models/class'
27
+ require 'mindbody-api/models/class_schedule'
28
+ require 'mindbody-api/models/payment'
29
+ require 'mindbody-api/models/sale'
30
+ require 'mindbody-api/models/sale_item'
31
+ require 'mindbody-api/models/service'
32
+ require 'mindbody-api/models/resource'
33
+ require 'mindbody-api/models/appointment_status'
34
+ require 'mindbody-api/models/appointment'
@@ -0,0 +1,22 @@
1
+ module MindBody
2
+ module Models
3
+ class Appointment < Base
4
+ attribute :id, Integer
5
+ attribute :status, AppointmentStatus
6
+ attribute :start_date_time, DateTime
7
+ attribute :end_date_time, DateTime
8
+ attribute :notes, String
9
+ attribute :staff_requested, Boolean
10
+ attribute :program, Program
11
+ attribute :session_type, SessionType
12
+ attribute :location, Location
13
+ attribute :staff, Staff
14
+ attribute :client, Client
15
+ attribute :first_appointment, Boolean
16
+ attribute :client_service, ClientService
17
+ attribute :resources, Array[Resource]
18
+ attribute :gender_preference, String
19
+ attribute :duration, Integer
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module MindBody
2
+ module Models
3
+ class AppointmentStatus < Base
4
+ VALID_STATUS = %w{Booked Completed Confirmed Arrived NoShow Cancelled}
5
+
6
+ attribute :status, String
7
+
8
+ def initialize(s)
9
+ self.status = VALID_STATUS.include?(s) ? s : nil
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module MindBody
2
+ module Models
3
+ class Availability < Base
4
+ attribute :id, Integer
5
+ attribute :programs, Array[Program]
6
+ attribute :start_date_time, DateTime
7
+ attribute :end_date_time, DateTime
8
+ attribute :bookable_end_date_time, DateTime
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ module MindBody
2
+ module Models
3
+ class Class < Base
4
+ attribute :id, Integer
5
+ attribute :class_schedule_id, Integer
6
+ attribute :visits, Array[Visit]
7
+ attribute :clients, Array[Client]
8
+ attribute :location, Location
9
+ attribute :max_capacity, Integer
10
+ attribute :web_capacity, Integer
11
+ attribute :total_booked, Integer
12
+ attribute :web_booked, Integer
13
+ attribute :semester_id, Semester
14
+ attribute :is_canceled, Boolean
15
+ attribute :substitute, Boolean
16
+ attribute :active, Boolean
17
+ attribute :is_waitlist_available, Boolean
18
+ attribute :is_enrolled, Boolean
19
+ attribute :hide_cancel, Boolean
20
+ attribute :is_available, Boolean
21
+ attribute :start_date_time, DateTime
22
+ attribute :end_date_time, DateTime
23
+ attribute :class_description, ClassDescription
24
+ attribute :staff, Staff
25
+
26
+ def name
27
+ class_description.name
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,14 @@
1
+ module MindBody
2
+ module Models
3
+ class ClassDescription < Base
4
+ attribute :level, Level
5
+ attribute :id, Integer
6
+ attribute :name, String
7
+ attribute :description, String
8
+ attribute :notes, String
9
+ attribute :last_updated, String
10
+ attribute :program, Program
11
+ attribute :session_type, SessionType
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ module MindBody
2
+ module Models
3
+ class ClassSchedule < Base
4
+ attribute :id, Integer
5
+ attribute :classes, Array[Class]
6
+ attribute :clients, Array[Client]
7
+ attribute :course, Course
8
+ attribute :semester_id, Integer
9
+ attribute :is_available, Boolean
10
+ attribute :class_description, ClassDescription
11
+ attribute :day_sunday, Boolean
12
+ attribute :day_monday, Boolean
13
+ attribute :day_tuesday, Boolean
14
+ attribute :day_wednesday, Boolean
15
+ attribute :day_thursday, Boolean
16
+ attribute :day_friday, Boolean
17
+ attribute :day_saturday, Boolean
18
+ attribute :start_time, Time
19
+ attribute :end_time, Time
20
+ attribute :start_date, Date
21
+ attribute :end_date, Date
22
+ attribute :staff, Staff
23
+ attribute :location, Location
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ module MindBody
2
+ module Models
3
+ class Client < Base
4
+ attribute :id, Integer
5
+ attribute :first_name, String
6
+ attribute :last_name, String
7
+ attribute :gender, String
8
+ attribute :email, String
9
+ attribute :email_opt_in, Boolean
10
+ attribute :address_line1, String
11
+ attribute :address_line2, String
12
+ attribute :city, String
13
+ attribute :state, String
14
+ attribute :postal_code, String
15
+ attribute :country, String
16
+ attribute :birth_date, Date
17
+ attribute :home_location, Location
18
+ attribute :is_prospect, Boolean
19
+ attribute :is_company, Boolean
20
+ attribute :notes, String
21
+ attribute :mobile_phone, String
22
+ attribute :home_phone, String
23
+ attribute :photo_url, String
24
+ attribute :username, String
25
+ attribute :first_appointment_date, DateTime
26
+
27
+ def name
28
+ "#{first_name} #{last_name}"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,16 @@
1
+ module MindBody
2
+ module Models
3
+ class ClientService < Base
4
+ attribute :id, Integer
5
+ attribute :current, Boolean
6
+ attribute :count, Integer
7
+ attribute :remaining, Integer
8
+ attribute :name, String
9
+ attribute :payment_date, DateTime
10
+ attribute :active_date, DateTime
11
+ attribute :expiration_date, DateTime
12
+ attribute :program, Program
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,16 @@
1
+ module MindBody
2
+ module Models
3
+ class Course < Base
4
+ attribute :id, Integer
5
+ attribute :name, String
6
+ attribute :description, String
7
+ attribute :notes, String
8
+ attribute :start_date, DateTime
9
+ attribute :end_date, DateTime
10
+ attribute :location, Location
11
+ attribute :organizer, Staff
12
+ attribute :program, Program
13
+ attribute :image_url, String
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module MindBody
2
+ module Models
3
+ class Level < Base
4
+ attribute :id, Integer
5
+ attribute :name, Integer
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ module MindBody
2
+ module Models
3
+ class Location < Base
4
+ attribute :id, Integer
5
+ attribute :business_id, Integer
6
+ attribute :site_id, Integer
7
+ attribute :business_description, String
8
+ attribute :additional_image_ur_ls, Array[String]
9
+ attribute :facility_square_feet, Integer
10
+ attribute :treatment_rooms, Integer
11
+ attribute :pro_spa_finder_site, Boolean
12
+ attribute :has_classes, Boolean
13
+ attribute :phone_extension, String
14
+ attribute :name, String
15
+ attribute :address, String
16
+ attribute :address2, String
17
+ attribute :tax1, Float
18
+ attribute :tax2, Float
19
+ attribute :tax3, Float
20
+ attribute :tax4, Float
21
+ attribute :tax5, Float
22
+ attribute :phone, String
23
+ attribute :city, String
24
+ attribute :state_prov_code, String
25
+ attribute :postal_code, String
26
+ attribute :latitude, Float
27
+ attribute :longitude, Float
28
+ attribute :distance_in_miles, Float
29
+ attribute :image_url, String
30
+ attribute :description, String
31
+ attribute :has_site, Boolean
32
+ attribute :can_book, Boolean
33
+
34
+ # No idea why it puts an underscore there
35
+ alias :additional_image_urls :additional_image_ur_ls
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,11 @@
1
+ module MindBody
2
+ module Models
3
+ class Payment < Base
4
+ attribute :id, Integer
5
+ attribute :amount, Float
6
+ attribute :method, Integer
7
+ attribute :type, String
8
+ attribute :notes, String
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module MindBody
2
+ module Models
3
+ class Program < Base
4
+ attribute :id, Integer
5
+ attribute :name, String
6
+ attribute :schedule_type, ScheduleType
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module MindBody
2
+ module Models
3
+ class Resource < Base
4
+ attribute :id, Integer
5
+ attribute :name, String
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module MindBody
2
+ module Models
3
+ class Sale < Base
4
+ attribute :id, Integer
5
+ attribute :sale_date_time, DateTime
6
+ attribute :location, Location
7
+ attribute :payments, Array[Payment]
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ module MindBody
2
+ module Models
3
+ class SaleItem < Base
4
+ attribute :sale, Sale
5
+ attribute :description, String
6
+ attribute :price, Float
7
+ attribute :amount_paid, Float
8
+ attribute :discount, Float
9
+ attribute :tax, Float
10
+ attribute :returned, Boolean
11
+ attribute :quantity, Integer
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module MindBody
2
+ module Models
3
+ class ScheduleType < Base
4
+ VALID_TYPES = %w{All DropIn Appointment Enrollment Resource Arrival Media}
5
+
6
+ attribute :type, String
7
+
8
+ def initialize(t)
9
+ self.type = VALID_TYPES.include?(t) ? t : nil
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module MindBody
2
+ module Models
3
+ class Semester < Base
4
+ attribute :id, Integer
5
+ attribute :start_date, DateTime
6
+ attribute :end_date, DateTime
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module MindBody
2
+ module Models
3
+ class Service < Base
4
+ attribute :id, Integer
5
+ attribute :price, Float
6
+ attribute :online_price, Float
7
+ attribute :tax_rate, Float
8
+ attribute :product_id, Float #why is this a float?
9
+ attribute :name, String
10
+ attribute :count, Integer
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ module MindBody
2
+ module Models
3
+ class SessionType < Base
4
+ attribute :id, Integer
5
+ attribute :name, String
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ module MindBody
2
+ module Models
3
+ class Site < Base
4
+ attribute :id, Integer
5
+ attribute :name, String
6
+ attribute :description, String
7
+ attribute :logo_url, String
8
+ attribute :page_color1, String
9
+ attribute :page_color2, String
10
+ attribute :page_color3, String
11
+ attribute :page_color4, String
12
+ attribute :accepts_visa, Boolean
13
+ attribute :accepts_discover, Boolean
14
+ attribute :accepts_master_card, Boolean
15
+ attribute :accepts_american_express, Boolean
16
+ attribute :contact_email, String
17
+
18
+ def page_colors
19
+ (1..4).collect {|i| self.send("page_color#{i}")}
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ module MindBody
2
+ module Models
3
+ class Staff < Base
4
+ attribute :id, Integer
5
+ attribute :email, String
6
+ attribute :mobile_phone, String
7
+ attribute :home_phone, String
8
+ attribute :work_phone, String
9
+ attribute :address, String
10
+ attribute :address2, String
11
+ attribute :city, String
12
+ attribute :state, String
13
+ attribute :country, String
14
+ attribute :postal_code, String
15
+ attribute :foreign_zip, String
16
+ attribute :login_locations, Array[Location]
17
+ attribute :name, String
18
+ attribute :first_name, String
19
+ attribute :last_name, String
20
+ attribute :image_url, String
21
+ attribute :bio, String
22
+ attribute :is_male, Boolean
23
+ attribute :username, String # API does not currently return this
24
+ attribute :availabilities, Array[Availability]
25
+ attribute :unavailabilities, Array[Unavailability]
26
+
27
+ # For API compatibility between Client
28
+ alias photo_url image_url
29
+ end
30
+ end
31
+ end
32
+