From 18879fcbcdb4c549840c59828f24662bb86844e2 Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 28 Jul 2015 10:22:21 -0400 Subject: [PATCH 01/13] Add UserCredentials --- lib/mindbody-api.rb | 4 +++- lib/mindbody-api/client.rb | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/mindbody-api.rb b/lib/mindbody-api.rb index ef100cb..ae176cf 100644 --- a/lib/mindbody-api.rb +++ b/lib/mindbody-api.rb @@ -18,13 +18,15 @@ def configuration end class Config - attr_accessor :log_level, :open_timeout, :read_timeout, :source_name, :source_key, :site_ids + attr_accessor :log_level, :open_timeout, :read_timeout, :source_name, :source_key, :site_ids, :username, :password def initialize @log_level = :debug @source_name = ENV['MINDBODY_SOURCE_NAME'] || '' @source_key = ENV['MINDBODY_SOURCE_KEY'] || '' @site_ids = (ENV['MINDBODY_SITE_IDS'] || '').scan(/-?\d+/).map(&:to_i) + @username = ENV['MINDBODY_USERNAME'] || '' + @password = ENV['MINDBODY_PASSWORD'] || '' end # Make sure site_ids is always an Array diff --git a/lib/mindbody-api/client.rb b/lib/mindbody-api/client.rb index 6d17444..62a1c34 100644 --- a/lib/mindbody-api/client.rb +++ b/lib/mindbody-api/client.rb @@ -21,9 +21,22 @@ def call(operation_name, locals = {}, &block) private def auth_params - {'SourceCredentials'=>{'SourceName'=>MindBody.configuration.source_name, - 'Password'=>MindBody.configuration.source_key, - 'SiteIDs'=>{'int'=>MindBody.configuration.site_ids}}} + { + 'SourceCredentials' => { + 'SourceName' => MindBody.configuration.source_name, + 'Password' => MindBody.configuration.source_key, + 'SiteIDs' => { + 'int' => MindBody.configuration.site_ids + } + }, + 'UserCredentials' => { + 'Username' => MindBody.configuration.username, + 'Password' => MindBody.configuration.password, + 'SiteIDs' => { + 'int' => MindBody.configuration.site_ids + } + } + } end def fixup_locals(locals) From 121e13b6d5842a8b829899ba97ba88bed8e5d58f Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 28 Jul 2015 10:22:53 -0400 Subject: [PATCH 02/13] Add resource to class --- lib/mindbody-api/models.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mindbody-api/models.rb b/lib/mindbody-api/models.rb index e8c4a3e..09b18d1 100644 --- a/lib/mindbody-api/models.rb +++ b/lib/mindbody-api/models.rb @@ -8,6 +8,7 @@ class Base end end +require 'mindbody-api/models/resource' require 'mindbody-api/models/location' require 'mindbody-api/models/client' require 'mindbody-api/models/schedule_type' @@ -29,6 +30,5 @@ class Base require 'mindbody-api/models/sale' require 'mindbody-api/models/sale_item' require 'mindbody-api/models/service' -require 'mindbody-api/models/resource' require 'mindbody-api/models/appointment_status' require 'mindbody-api/models/appointment' From 79f965817975de14bb820f734b04f5a75cd420a6 Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 28 Jul 2015 10:59:43 -0400 Subject: [PATCH 03/13] Add resource to class --- lib/mindbody-api/models/class.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mindbody-api/models/class.rb b/lib/mindbody-api/models/class.rb index 4c54e87..3258587 100644 --- a/lib/mindbody-api/models/class.rb +++ b/lib/mindbody-api/models/class.rb @@ -22,6 +22,7 @@ class Class < Base attribute :end_date_time, DateTime attribute :class_description, ClassDescription attribute :staff, Staff + attribute :resource, Resource def name class_description.name From 9108b9c931e5b7ceb0dc1bd25c94d92a937f42f0 Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 4 Aug 2015 18:01:24 -0400 Subject: [PATCH 04/13] Add late_cancelled field to Visit model --- lib/mindbody-api/models/visit.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mindbody-api/models/visit.rb b/lib/mindbody-api/models/visit.rb index c8edc91..b7f4827 100644 --- a/lib/mindbody-api/models/visit.rb +++ b/lib/mindbody-api/models/visit.rb @@ -12,6 +12,7 @@ class Visit < Base attribute :web_signup, Boolean attribute :signed_in, Boolean attribute :make_up, Boolean + attribute :late_cancelled, Boolean attribute :service, ClientService end end From 2d7cf4b03e09482f676caa0dd0c5e19d72ad1fdf Mon Sep 17 00:00:00 2001 From: David Macht Date: Thu, 6 Aug 2015 12:12:18 -0400 Subject: [PATCH 05/13] Fix for array with one element --- lib/mindbody-api/response.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mindbody-api/response.rb b/lib/mindbody-api/response.rb index 8157c6c..559141e 100644 --- a/lib/mindbody-api/response.rb +++ b/lib/mindbody-api/response.rb @@ -67,9 +67,11 @@ def normalize_hash(hash) hash[key] = normalize_hash(value) key_singular = map_key(key).singularize.to_sym + key_plural = key.to_s.pluralize.to_sym if value.has_key?(key_singular) - hash[key] = value[key_singular] + val = value[key_singular] + hash[key] = (val.is_a?(Array)) ? val : [val] elsif value.has_key?(:string) hash[key] = value[:string] elsif value.has_key?(:int) From d729821ba1ab40e4e479192c4997d182bd169ba6 Mon Sep 17 00:00:00 2001 From: David Macht Date: Thu, 13 Aug 2015 11:11:19 -0400 Subject: [PATCH 06/13] Add and remove clients from classes --- lib/mindbody-api/services/class_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mindbody-api/services/class_service.rb b/lib/mindbody-api/services/class_service.rb index 63ffbaf..f38d0d9 100644 --- a/lib/mindbody-api/services/class_service.rb +++ b/lib/mindbody-api/services/class_service.rb @@ -4,9 +4,11 @@ class ClassService < Service service "ClassService" operation :get_classes - operation :get_class_visits, required:[:class_id] + operation :get_class_visits, required:[:class_id] operation :get_class_descriptions operation :get_class_schedules + operation :add_clients_to_classes, required: [:class_ids, :client_ids] + operation :remove_clients_from_classes, required: [:class_ids, :client_ids] end end end From a7119404229635cfec98a5bc386f5de4b682d858 Mon Sep 17 00:00:00 2001 From: David Macht Date: Thu, 20 Aug 2015 17:14:34 -0400 Subject: [PATCH 07/13] Production mode env settings --- lib/mindbody-api.rb | 3 ++- lib/mindbody-api/client.rb | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/mindbody-api.rb b/lib/mindbody-api.rb index ae176cf..2312ed0 100644 --- a/lib/mindbody-api.rb +++ b/lib/mindbody-api.rb @@ -18,7 +18,7 @@ def configuration end class Config - attr_accessor :log_level, :open_timeout, :read_timeout, :source_name, :source_key, :site_ids, :username, :password + attr_accessor :log_level, :open_timeout, :read_timeout, :source_name, :source_key, :site_ids, :username, :password, :prod_mode def initialize @log_level = :debug @@ -27,6 +27,7 @@ def initialize @site_ids = (ENV['MINDBODY_SITE_IDS'] || '').scan(/-?\d+/).map(&:to_i) @username = ENV['MINDBODY_USERNAME'] || '' @password = ENV['MINDBODY_PASSWORD'] || '' + @prod_mode = ENV['MINDBODY_PROD_MODE'] || false end # Make sure site_ids is always an Array diff --git a/lib/mindbody-api/client.rb b/lib/mindbody-api/client.rb index 62a1c34..a6d7a78 100644 --- a/lib/mindbody-api/client.rb +++ b/lib/mindbody-api/client.rb @@ -21,7 +21,7 @@ def call(operation_name, locals = {}, &block) private def auth_params - { + params = { 'SourceCredentials' => { 'SourceName' => MindBody.configuration.source_name, 'Password' => MindBody.configuration.source_key, @@ -37,6 +37,8 @@ def auth_params } } } + params.merge!({"Test" => true}) unless MindBody.configuration.prod_mode + params end def fixup_locals(locals) From c2ca73b009bcb34e8c76d913446888867baaf4d8 Mon Sep 17 00:00:00 2001 From: David Macht Date: Thu, 20 Aug 2015 17:15:13 -0400 Subject: [PATCH 08/13] Checkout shopping card call --- lib/mindbody-api/services/sale_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mindbody-api/services/sale_service.rb b/lib/mindbody-api/services/sale_service.rb index 50e7c05..b5beeea 100644 --- a/lib/mindbody-api/services/sale_service.rb +++ b/lib/mindbody-api/services/sale_service.rb @@ -5,6 +5,7 @@ class SaleService < Service operation :get_accepted_card_type, :locals => false operation :get_sales + operation :checkout_shopping_cart, :required => [:client_id, :cart_items, :payments] operation :get_services operation :get_packages operation :get_products From fd5b4b77bbe10745ddadcc0e458b61c26530919a Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 22 Sep 2015 19:34:59 -0400 Subject: [PATCH 09/13] Add waitlist --- lib/mindbody-api/models.rb | 1 + lib/mindbody-api/models/client.rb | 1 + lib/mindbody-api/models/waitlist_entry.rb | 11 +++++++++++ lib/mindbody-api/services/class_service.rb | 1 + 4 files changed, 14 insertions(+) create mode 100644 lib/mindbody-api/models/waitlist_entry.rb diff --git a/lib/mindbody-api/models.rb b/lib/mindbody-api/models.rb index 09b18d1..12685a6 100644 --- a/lib/mindbody-api/models.rb +++ b/lib/mindbody-api/models.rb @@ -32,3 +32,4 @@ class Base require 'mindbody-api/models/service' require 'mindbody-api/models/appointment_status' require 'mindbody-api/models/appointment' +require 'mindbody-api/models/waitlist_entry' \ No newline at end of file diff --git a/lib/mindbody-api/models/client.rb b/lib/mindbody-api/models/client.rb index 96f6bf7..111e247 100644 --- a/lib/mindbody-api/models/client.rb +++ b/lib/mindbody-api/models/client.rb @@ -5,6 +5,7 @@ class Client < Base attribute :first_name, String attribute :last_name, String attribute :gender, String + attribute :account_balance, Float attribute :email, String attribute :email_opt_in, Boolean attribute :address_line1, String diff --git a/lib/mindbody-api/models/waitlist_entry.rb b/lib/mindbody-api/models/waitlist_entry.rb new file mode 100644 index 0000000..8a6cb13 --- /dev/null +++ b/lib/mindbody-api/models/waitlist_entry.rb @@ -0,0 +1,11 @@ +module MindBody + module Models + class WaitlistEntry < Base + attribute :id, Integer + attribute :class_id, Integer + attribute :class_date, DateTime + attribute :client, Client + attribute :class_schedule, ClassSchedule + end + end +end \ No newline at end of file diff --git a/lib/mindbody-api/services/class_service.rb b/lib/mindbody-api/services/class_service.rb index f38d0d9..170a5b9 100644 --- a/lib/mindbody-api/services/class_service.rb +++ b/lib/mindbody-api/services/class_service.rb @@ -7,6 +7,7 @@ class ClassService < Service operation :get_class_visits, required:[:class_id] operation :get_class_descriptions operation :get_class_schedules + operation :get_waitlist_entries, required: [:class_ids] operation :add_clients_to_classes, required: [:class_ids, :client_ids] operation :remove_clients_from_classes, required: [:class_ids, :client_ids] end From fefa1125d826f29f0f1e5e363596e2e7d1cae73c Mon Sep 17 00:00:00 2001 From: David Macht Date: Tue, 10 Nov 2015 13:21:06 -0500 Subject: [PATCH 10/13] Add emergency info to client model --- lib/mindbody-api/models/client.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mindbody-api/models/client.rb b/lib/mindbody-api/models/client.rb index 111e247..302e69b 100644 --- a/lib/mindbody-api/models/client.rb +++ b/lib/mindbody-api/models/client.rb @@ -24,6 +24,10 @@ class Client < Base attribute :photo_url, String attribute :username, String attribute :first_appointment_date, DateTime + attribute :emergency_contact_info_name, String + attribute :emergency_contact_info_relationship, String + attribute :emergency_contact_info_phone, String + attribute :emergency_contact_info_email, String def name "#{first_name} #{last_name}" From 63840ef7d105ae843af4c062fa4bd1fcd33cc1de Mon Sep 17 00:00:00 2001 From: Ed Ropple Date: Mon, 4 Jan 2016 04:10:49 -0500 Subject: [PATCH 11/13] Added support for per-call credentials to MindBody - Added an 'auth:' named local for MindBody::Client#call that allows custom per-call credentials. If no parameter is passed, falls back to the standard behavior of using MindBody::configuration for client details. - Fixed broken tests (missing mocks) - Added tests for 'auth:' cases. --- lib/mindbody-api/client.rb | 52 +++++++++++++++++++++++----------- mindbody-api.gemspec | 1 + spec/client_spec.rb | 57 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 16 deletions(-) diff --git a/lib/mindbody-api/client.rb b/lib/mindbody-api/client.rb index a6d7a78..9553807 100644 --- a/lib/mindbody-api/client.rb +++ b/lib/mindbody-api/client.rb @@ -10,9 +10,13 @@ def call(operation_name, locals = {}, &block) @globals.open_timeout(MindBody.configuration.open_timeout) @globals.read_timeout(MindBody.configuration.read_timeout) @globals.log_level(MindBody.configuration.log_level) + + auth = locals[:auth] + locals.delete(:auth) + locals = locals.has_key?(:message) ? locals[:message] : locals locals = fixup_locals(locals) - params = {:message => {'Request' => auth_params.merge(locals)}} + params = {:message => {'Request' => auth_params(auth).merge(locals)}} # Run the request response = super(operation_name, params, &block) @@ -20,23 +24,39 @@ def call(operation_name, locals = {}, &block) end private - def auth_params - params = { - 'SourceCredentials' => { - 'SourceName' => MindBody.configuration.source_name, - 'Password' => MindBody.configuration.source_key, - 'SiteIDs' => { - 'int' => MindBody.configuration.site_ids - } - }, - 'UserCredentials' => { - 'Username' => MindBody.configuration.username, - 'Password' => MindBody.configuration.password, - 'SiteIDs' => { - 'int' => MindBody.configuration.site_ids + def auth_params(auth = nil) + auth ||= + { + :source_name => MindBody.configuration.source_name, + :source_key => MindBody.configuration.source_key, + :username => MindBody.configuration.username, + :password => MindBody.configuration.password, + + :site_ids => MindBody.configuration.site_ids + } + + params = + { + 'SourceCredentials' => { + 'SourceName' => auth[:source_name], + 'Password' => auth[:source_key], + 'SiteIDs' => { + 'int' => auth[:site_ids] + } } } - } + + if (auth[:username] && auth[:password]) + params['UserCredentials'] = + { + 'Username' => auth[:username], + 'Password' => auth[:password], + 'SiteIDs' => { + 'int' => auth[:site_ids] + } + } + end + params.merge!({"Test" => true}) unless MindBody.configuration.prod_mode params end diff --git a/mindbody-api.gemspec b/mindbody-api.gemspec index 4d3a621..2cde5e3 100644 --- a/mindbody-api.gemspec +++ b/mindbody-api.gemspec @@ -26,4 +26,5 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'simplecov', '~> 0.8.2' gem.add_development_dependency 'guard-rspec', '~> 4.2.8' gem.add_development_dependency 'rake', '~> 10.0.3' + gem.add_development_dependency 'pry' end diff --git a/spec/client_spec.rb b/spec/client_spec.rb index e6e22de..a0be5ce 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -7,6 +7,11 @@ creds.stub(:source_name).and_return('test') creds.stub(:source_key).and_return('test_key') creds.stub(:site_ids).and_return([-99]) + creds.stub(:open_timeout).and_return(nil) + creds.stub(:read_timeout).and_return(nil) + creds.stub(:username).and_return(nil) + creds.stub(:password).and_return(nil) + creds.stub(:prod_mode).and_return(true) MindBody.stub(:configuration).and_return(creds) @client = MindBody::Services::Client.new(:wsdl => 'spec/fixtures/wsdl/geotrust.wsdl') @@ -30,6 +35,58 @@ } }}} end + + # We use #send here because `auth_params` is a private method and when + # adding this functionality I didn't want to change the public API contract. + # This should be considered an external-facing unit test as calls to + # {#call} now respect `auth:` alongside `:message`. + describe " (when using `auth:`)" do + it 'should inject MindBody.configuration values for the nil case' do + ret = subject.send(:auth_params, nil) + + expect(ret["SourceCredentials"]["SourceName"]).to eq('test') + expect(ret["SourceCredentials"]["Password"]).to eq('test_key') + expect(ret["SourceCredentials"]["SiteIDs"]["int"]).to eq([-99]) + expect(ret["UserCredentials"]).to be_nil + end + + it 'should defer to passed-in values when provided' do + auth = { + :source_name => "override_name", + :source_key => "override_key", + :site_ids => [ -105 ] + } + + ret = subject.send(:auth_params, auth) + + expect(ret["SourceCredentials"]["SourceName"]).to eq('override_name') + expect(ret["SourceCredentials"]["Password"]).to eq('override_key') + expect(ret["SourceCredentials"]["SiteIDs"]["int"]).to eq([-105]) + expect(ret["UserCredentials"]).to be_nil + end + + it 'should inject UserCredentials when provided' do + auth = { + :source_name => "override_name", + :source_key => "override_key", + + :username => "override_user", + :password => "override_pass", + + :site_ids => [ -105 ] + } + + ret = subject.send(:auth_params, auth) + + expect(ret["SourceCredentials"]["SourceName"]).to eq('override_name') + expect(ret["SourceCredentials"]["Password"]).to eq('override_key') + expect(ret["SourceCredentials"]["SiteIDs"]["int"]).to eq([-105]) + expect(ret["UserCredentials"]["Username"]).to eq('override_user') + expect(ret["UserCredentials"]["Password"]).to eq('override_pass') + expect(ret["UserCredentials"]["SiteIDs"]["int"]).to eq([-105]) + end + end + it 'should inject the auth params' do Savon::Operation.any_instance.should_receive(:call).once.with(@locals) subject.call(:hello) From 060b3c435d641653ee1d37a15d809fd5da77dfa8 Mon Sep 17 00:00:00 2001 From: Ed Ropple Date: Mon, 4 Jan 2016 04:50:20 -0500 Subject: [PATCH 12/13] created 'xxx_with_auth' methods to enable auth overrides in services --- lib/mindbody-api/ext/savon_ext.rb | 20 ++++++++++++++++ spec/service_spec.rb | 38 +++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/lib/mindbody-api/ext/savon_ext.rb b/lib/mindbody-api/ext/savon_ext.rb index d9ed2f4..41606ca 100644 --- a/lib/mindbody-api/ext/savon_ext.rb +++ b/lib/mindbody-api/ext/savon_ext.rb @@ -15,9 +15,23 @@ def #{operation.to_s.snakecase}(#{params.join(',')}) .join(',')} } locals ||= {} + client.call #{operation.inspect}, :message => locals.merge(req_hash) end RUBY_EVAL + + class_operation_module.module_eval <<-RUBY_EVAL, __FILE__, __LINE__+1 + def #{operation.to_s.snakecase}_with_auth(auth#{!params.empty? ? ',' : ''} #{params.join(',')}) + req_hash = { + #{params.select{|p| p != 'locals = {}'} + .map{|p| "'#{params_key(p)}' => #{p}"} + .join(',')} + } + locals ||= {} + + client.call #{operation.inspect}, :auth => auth, :message => locals.merge(req_hash) + end + RUBY_EVAL end # Defines an instance-level SOAP operation. @@ -31,6 +45,12 @@ def #{operation.to_s.snakecase}(#{params.join(',')}) self.class.#{operation.to_s.snakecase} #{params.join(',').chomp(' = {}')} end RUBY_EVAL + + instance_operation_module.module_eval <<-RUBY_EVAL, __FILE__, __LINE__+1 + def #{operation.to_s.snakecase}_with_auth(auth#{!params.empty? ? ',' : ''} #{params.join(',')}) + self.class.#{operation.to_s.snakecase}_with_auth(auth, #{params.join(',').chomp(' = {}')}) + end + RUBY_EVAL end # Builds the array of params the diff --git a/spec/service_spec.rb b/spec/service_spec.rb index fe88b38..38ae890 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -30,11 +30,18 @@ MindBody::Services::Service.operation :test end - it { should respond_to(:test) } - its(:new) { should respond_to(:test) } + it do + should respond_to(:test) + should respond_to(:test_with_auth) + end + its(:new) do + should respond_to(:test) + should respond_to(:test_with_auth) + end it 'should have optional locals' do expect(subject.method(:test).arity).to eql(-1) + expect(subject.method(:test_with_auth).arity).to eql(-2) end it 'should delegate to the class method' do @@ -42,8 +49,10 @@ locals = {:foo => :bar} subject.should_receive(:test).with(locals).once - instance.test(locals) + + subject.should_receive(:test_with_auth).with({}, locals).once + instance.test_with_auth({}, locals) end end @@ -52,11 +61,18 @@ MindBody::Services::Service.operation :test_required, :required => [:foo, :bar] end - it { should respond_to(:test_required) } - its(:new) { should respond_to(:test_required) } + it do + should respond_to(:test_required) + should respond_to(:test_required_with_auth) + end + its(:new) do + should respond_to(:test_required) + should respond_to(:test_required_with_auth) + end it 'should have two required params and optional locals' do expect(subject.method(:test_required).arity).to eql(-3) + expect(subject.method(:test_required_with_auth).arity).to eql(-4) end it 'should delegate to the class method' do @@ -64,11 +80,14 @@ locals = {:foo => :bar} subject.should_receive(:test_required).with(:foo, :bar, locals).once - instance.test_required(:foo, :bar, locals) + + subject.should_receive(:test_required_with_auth).with({}, :foo, :bar, locals).once + instance.test_required_with_auth({}, :foo, :bar, locals) end it 'should require two params' do + expect{subject.send(:test_required_with_auth, {})}.to raise_error(ArgumentError) expect{subject.send(:test_required)}.to raise_error(ArgumentError) end end @@ -83,21 +102,26 @@ it 'should have two required params and optional locals' do expect(subject.method(:test_no_locals).arity).to eql(2) + expect(subject.method(:test_no_locals_with_auth).arity).to eql(3) end it 'should delegate to the class method' do instance = subject.new subject.should_receive(:test_no_locals).with(:foo, :bar).once - instance.test_no_locals(:foo, :bar) + + subject.should_receive(:test_no_locals_with_auth).with({}, :foo, :bar).once + instance.test_no_locals_with_auth({}, :foo, :bar) end it 'should require two params' do + expect{subject.send(:test_no_locals_with_auth, {})}.to raise_error(ArgumentError) expect{subject.send(:test_no_locals)}.to raise_error(ArgumentError) end it 'should not allow locals' do + expect{subject.send(:test_no_locals_with_auth, {}, :foo, :bar, :foobar => 'foobar')}.to raise_error(ArgumentError) expect{subject.send(:test_no_locals, :foo, :bar, :foobar => 'foobar')}.to raise_error(ArgumentError) end end From 7f11c0611ee82996467b5697d85814db56186424 Mon Sep 17 00:00:00 2001 From: Ed Ropple Date: Mon, 4 Jan 2016 04:53:21 -0500 Subject: [PATCH 13/13] fixed bug: username/password should be nil, not empty strings, in defaults --- lib/mindbody-api.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mindbody-api.rb b/lib/mindbody-api.rb index 2312ed0..7d77635 100644 --- a/lib/mindbody-api.rb +++ b/lib/mindbody-api.rb @@ -25,8 +25,8 @@ def initialize @source_name = ENV['MINDBODY_SOURCE_NAME'] || '' @source_key = ENV['MINDBODY_SOURCE_KEY'] || '' @site_ids = (ENV['MINDBODY_SITE_IDS'] || '').scan(/-?\d+/).map(&:to_i) - @username = ENV['MINDBODY_USERNAME'] || '' - @password = ENV['MINDBODY_PASSWORD'] || '' + @username = ENV['MINDBODY_USERNAME'] || nil + @password = ENV['MINDBODY_PASSWORD'] || nil @prod_mode = ENV['MINDBODY_PROD_MODE'] || false end