mindbody 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,7 +107,7 @@ module Mb
107
107
  end
108
108
 
109
109
  #Build a Mindbody SOAP request for the given service
110
- def get_service(service_symbol, options)
110
+ def get_service(service_symbol, options, unwrap_bool)
111
111
  raise "No SOAP client instantiated" unless @client
112
112
 
113
113
  request_options = build_request(options)
@@ -119,13 +119,26 @@ module Mb
119
119
  {
120
120
  "Request" => request_options
121
121
  }
122
+
123
+ if unwrap_bool
124
+ #Unwrap response to hash array underneath)
125
+ plural = service_symbol.to_s.gsub("get_", "")
126
+ singular =plural[0..-1] #Remove last
127
+ r = response.to_hash
128
+ basify = lambda {|end| (service_symbol.to_s + "_" + end).to_sym}
129
+ r = r[basify('response')][basify('result'][plural.to_sym][singular.to_sym]
130
+ return r
131
+ end
132
+
133
+ response
122
134
  end
123
135
  end
124
136
 
125
137
  def method_missing(method_id, *arguments, &block)
126
138
  if method_id.to_s =~ /^get_\w+/
127
139
  options = arguments[0] || {}
128
- get_service method_id.to_sym, options.is_a?(Hash) ? options : {}
140
+ non_mb_options = arguments[1] || {}
141
+ get_service method_id.to_sym, options.is_a?(Hash) ? options : {}, non_mb_options[:unwrap]
129
142
  else
130
143
  super
131
144
  end
@@ -1,3 +1,3 @@
1
1
  module Mindbody
2
- Version = "0.0.6"
2
+ Version = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindbody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: savon
17
- requirement: &2153535740 !ruby/object:Gem::Requirement
17
+ requirement: &2157408240 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 0.9.2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2153535740
25
+ version_requirements: *2157408240
26
26
  description: Ruby's interface to the Mindbody 0.5 API with no bell's and whistles
27
27
  email: tgoffman@gmail.com
28
28
  executables: []