yield_star_client 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.2.0 (2012-01-16)
2
+
3
+ * Moved the client_name to the configuration, since it is required
4
+ for every call to the remote service. The client_name parameter has
5
+ been removed from the method signature for all service calls, which
6
+ breaks backwards compatibility with v0.1.x.
7
+ * Added the :debug and :logger configuration options to prevent savon
8
+ from dumping all soap messages to STDOUT.
9
+ * Various minor cleanup around configuration.
10
+
1
11
  ## 0.1.1 (2011-06-14)
2
12
 
3
13
  * Bug fix: explicitly namespace all require statements to avoid
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 G5
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -20,7 +20,6 @@ module YieldStarClient
20
20
 
21
21
  # Retrieves all of the amenities associated with a specific floor plan.
22
22
  #
23
- # @param [String] client_name the YieldStar client name
24
23
  # @param [String] external_property_id the ID of the property where the floor plan is located
25
24
  # @param [String] floor_plan_name the name of the floor plan
26
25
  #
@@ -31,13 +30,11 @@ module YieldStarClient
31
30
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
32
31
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
33
32
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
34
- def get_floor_plan_amenities(client_name, external_property_id, floor_plan_name)
35
- validate_client_name!(client_name)
33
+ def get_floor_plan_amenities(external_property_id, floor_plan_name)
36
34
  validate_external_property_id!(external_property_id)
37
35
  validate_required!(:floor_plan_name => floor_plan_name)
38
36
 
39
- response = send_soap_request(:get_floor_plan_amenities, :client_name => client_name,
40
- :external_property_id => external_property_id,
37
+ response = send_soap_request(:get_floor_plan_amenities, :external_property_id => external_property_id,
41
38
  :floor_plan_name => floor_plan_name)
42
39
 
43
40
  amenities = response.to_hash[:get_floor_plan_amenities_response][:return][:amenity] || []
@@ -46,7 +43,6 @@ module YieldStarClient
46
43
 
47
44
  # Retrieves all of the amenities associated with a specific unit.
48
45
  #
49
- # @param [String] client_name the YieldStar client name
50
46
  # @param [String] external_property_id the ID of the property where the floor plan is located
51
47
  # @param [String] unit_name the name of the unit
52
48
  # @param [optional,String] building the name of the building where the unit is located
@@ -58,13 +54,11 @@ module YieldStarClient
58
54
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
59
55
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
60
56
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
61
- def get_unit_amenities(client_name, external_property_id, unit_name, building=nil)
62
- validate_client_name!(client_name)
57
+ def get_unit_amenities(external_property_id, unit_name, building=nil)
63
58
  validate_external_property_id!(external_property_id)
64
59
  validate_required!(:unit_name => unit_name)
65
60
 
66
- body = {:client_name => client_name,
67
- :external_property_id => external_property_id,
61
+ body = {:external_property_id => external_property_id,
68
62
  :unit_name => unit_name}
69
63
  body[:building] = building if building
70
64
 
@@ -27,6 +27,20 @@ module YieldStarClient
27
27
  define_method(opt) { get_value(opt) }
28
28
  end
29
29
 
30
+ def debug=(val)
31
+ @debug = val
32
+ Savon.log = self.debug?
33
+ end
34
+
35
+ def debug?
36
+ get_value(:debug).to_s == 'true'
37
+ end
38
+
39
+ def logger=(val)
40
+ @logger = val
41
+ Savon.logger = self.logger
42
+ end
43
+
30
44
  # Initializes the client. All options are truly optional; if the option
31
45
  # is not supplied to this method, then it will be set based on the
32
46
  # YieldStarClient configuration.
@@ -36,9 +50,13 @@ module YieldStarClient
36
50
  # @param [Hash] options
37
51
  # @option options [String] :username The username for authenticating to the web service.
38
52
  # @option options [String] :password The password for authenticating to the web service.
53
+ # @option options [String] :client_name The YieldStar client name (required for all requests)
39
54
  # @option options [String] :endpoint The address for connecting to the web service.
40
55
  # @option options [String] :namespace The XML namespace to use for requests.
56
+ # @option options [true,false] :debug true to enable debug logging of SOAP traffic; defaults to false
41
57
  def initialize(options={})
58
+ self.debug = nil
59
+ self.logger = nil
42
60
  options.each { |k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") }
43
61
  end
44
62
 
@@ -49,10 +67,12 @@ module YieldStarClient
49
67
  # @param [Hash] soap_parameters the parameters to populate the request body
50
68
  # @return [Savon::SOAP::Response]
51
69
  def send_soap_request(soap_action,soap_parameters={})
70
+ validate_client_name!(client_name)
71
+ default_params = { :client_name => client_name }
52
72
  begin
53
73
  response = soap_client.request :wsdl, soap_action do
54
74
  soap.element_form_default = :qualified
55
- soap.body = { :request => soap_parameters }
75
+ soap.body = { :request => default_params.merge(soap_parameters) }
56
76
  end
57
77
  rescue Savon::SOAP::Fault => f
58
78
  raise ServerError.translate_fault(f)
@@ -78,7 +98,8 @@ module YieldStarClient
78
98
  # @param [Symbol] attribute the name of the attribute
79
99
  # @return [String] the value of the attribute
80
100
  def get_value(attribute)
81
- instance_variable_get("@#{attribute}") || YieldStarClient.send(attribute)
101
+ local_val = instance_variable_get("@#{attribute}")
102
+ local_val.nil? ? YieldStarClient.send(attribute) : local_val
82
103
  end
83
104
  end
84
105
  end
@@ -0,0 +1,94 @@
1
+ require 'configlet'
2
+ require 'logger'
3
+
4
+ module YieldStarClient
5
+ # All valid configuration options.
6
+ #
7
+ # @see YieldStarClient.configure
8
+ VALID_CONFIG_OPTIONS = [:endpoint, :username, :password, :namespace, :client_name,
9
+ :debug, :logger]
10
+
11
+ DEFAULT_ENDPOINT = 'https://rmsws.yieldstar.com/rmsws/AppExchange'
12
+ DEFAULT_NAMESPACE = 'http://yieldstar.com/ws/AppExchange/v1'
13
+
14
+ module Configuration
15
+ include Configlet
16
+
17
+ def self.extended(base)
18
+ # Default configuration - happens whether or not .configure is called
19
+ base.config :yield_star do
20
+ default :endpoint => DEFAULT_ENDPOINT
21
+ default :namespace => DEFAULT_NAMESPACE
22
+ default :debug => false
23
+ end
24
+ end
25
+
26
+ # Mutators and accessors for simple configuration options
27
+ VALID_CONFIG_OPTIONS.each do |config_opt|
28
+ define_method(config_opt) do
29
+ self[config_opt]
30
+ end
31
+
32
+ define_method("#{config_opt}=".to_sym) do |val|
33
+ self[config_opt] = val ? val.to_s : nil
34
+ end
35
+ end
36
+
37
+ # True if debug logging of SOAP requests and responses has been enabled;
38
+ # false otherwise.
39
+ def debug?
40
+ self[:debug] == 'true'
41
+ end
42
+
43
+ # Custom logger object for debug logging; defaults to STDOUT.
44
+ attr_writer :logger
45
+
46
+ def logger
47
+ @logger ||= Logger.new(STDOUT)
48
+ end
49
+
50
+ # Configures this module through the given +block+.
51
+ # Default configuration options will be applied unless
52
+ # they are explicitly overridden in the +block+.
53
+ #
54
+ # @yield [_self] configures service connection options
55
+ # @yieldparam [YieldstarClient] _self the object on which the configure method was called
56
+ # @example Typical case utilizing defaults
57
+ # YieldStarClient.configure do |config|
58
+ # config.username = 'my_user'
59
+ # config.password = 'my_pass'
60
+ # config.client_name = 'my_client'
61
+ # end
62
+ # @example Overriding defaults
63
+ # YieldStarClient.configure do |config|
64
+ # config.username = 'my_user'
65
+ # config.password = 'my_pass'
66
+ # config.client_name = 'my_client'
67
+ # config.endpoint = 'http://my.endpoint.com'
68
+ # config.namespace = 'http://my.namespace.com'
69
+ # config.debug = true
70
+ # config.logger = Logger.new('my.log')
71
+ # end
72
+ # @return [YieldStarClient] _self
73
+ # @see VALID_CONFIG_OPTIONS
74
+ def configure
75
+ config :yield_star do
76
+ yield self
77
+ end
78
+
79
+ self
80
+ end
81
+
82
+ # Resets this module's configuration.
83
+ # Configuration options will be set to default values
84
+ # if they exist; otherwise, they will be set to nil.
85
+ #
86
+ # @see VALID_CONFIG_OPTIONS
87
+ # @see DEFAULT_ENDPOINT
88
+ # @see DEFAULT_NAMESPACE
89
+ def reset
90
+ VALID_CONFIG_OPTIONS.each { |opt| self.send("#{opt}=", nil) }
91
+ self.logger = nil
92
+ end
93
+ end
94
+ end
@@ -29,7 +29,6 @@ module YieldStarClient
29
29
 
30
30
  # Retrieves all floor plans for a particular property.
31
31
  #
32
- # @param [String] client_name the YieldStar client name
33
32
  # @param [String] external_property_id the ID of the property
34
33
  # @return [Array<YieldStarClient::FloorPlan>] list of floor plans
35
34
  #
@@ -38,11 +37,10 @@ module YieldStarClient
38
37
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
39
38
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
40
39
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
41
- def get_floor_plans(client_name, external_property_id)
42
- validate_client_name!(client_name)
40
+ def get_floor_plans(external_property_id)
43
41
  validate_external_property_id!(external_property_id)
44
42
 
45
- response = send_soap_request(:get_floor_plans, :client_name => client_name, :external_property_id => external_property_id)
43
+ response = send_soap_request(:get_floor_plans, :external_property_id => external_property_id)
46
44
 
47
45
  floor_plans = response.to_hash[:get_floor_plans_response][:return][:floor_plan] || []
48
46
  floor_plans = [floor_plans].flatten
@@ -52,7 +50,6 @@ module YieldStarClient
52
50
 
53
51
  # Retrieves a specific floor plan.
54
52
  #
55
- # @param [String] client_name the YieldStar client name
56
53
  # @param [String] external_property_id the ID of the property
57
54
  # @param [String] floor_plan_name the name of the floor plan
58
55
  # @return [YieldStarClient::FloorPlan] the floor plan data
@@ -62,13 +59,11 @@ module YieldStarClient
62
59
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
63
60
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
64
61
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
65
- def get_floor_plan(client_name, external_property_id, floor_plan_name)
66
- validate_client_name!(client_name)
62
+ def get_floor_plan(external_property_id, floor_plan_name)
67
63
  validate_external_property_id!(external_property_id)
68
64
  validate_required!(:floor_plan_name => floor_plan_name)
69
65
 
70
- response = send_soap_request(:get_floor_plan, :client_name => client_name,
71
- :external_property_id => external_property_id,
66
+ response = send_soap_request(:get_floor_plan, :external_property_id => external_property_id,
72
67
  :name => floor_plan_name)
73
68
  floor_plan = response.to_hash[:get_floor_plan_response][:return][:floor_plan]
74
69
 
@@ -83,7 +83,6 @@ module YieldStarClient
83
83
  # Retrieves a matrix providing the specific rate for each combination of
84
84
  # lease term and move-in date for a particular unit.
85
85
  #
86
- # @param [String] client_name the YieldStar client name
87
86
  # @param [String] external_property_id the ID of the property where the unit is located
88
87
  # @param [String] unit_number the unit_number that identifies the available unit
89
88
  # @param [Hash] opts optional filters for lease term data
@@ -102,11 +101,10 @@ module YieldStarClient
102
101
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
103
102
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
104
103
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
105
- def get_lease_term_rent(client_name, external_property_id, unit_number, opts={})
104
+ def get_lease_term_rent(external_property_id, unit_number, opts={})
106
105
  opts ||= {}
107
- call_lease_term_rent_method(client_name,
108
- external_property_id,
109
- unit_number,
106
+ call_lease_term_rent_method(external_property_id,
107
+ unit_number,
110
108
  opts.merge(:request_element => :lease_term_rent_unit_request,
111
109
  :soap_action => :get_lease_term_rent,
112
110
  :response_element => :lease_term_rent_unit_response,
@@ -117,11 +115,10 @@ module YieldStarClient
117
115
  # the last date for which the price is valid.
118
116
  #
119
117
  # {see #get_lease_term_rent}
120
- def get_lease_term_rent_plus(client_name, external_property_id, unit_number, opts={})
118
+ def get_lease_term_rent_plus(external_property_id, unit_number, opts={})
121
119
  opts ||= {}
122
- call_lease_term_rent_method(client_name,
123
- external_property_id,
124
- unit_number,
120
+ call_lease_term_rent_method(external_property_id,
121
+ unit_number,
125
122
  opts.merge(:request_element => :lease_term_rent_unit_request,
126
123
  :soap_action => :get_lease_term_rent_plus,
127
124
  :response_element => :lease_term_rent_unit_plus_response,
@@ -131,7 +128,6 @@ module YieldStarClient
131
128
  # Retrieves rate data for units that are within "Renewal Notice Days" of lease expiration,
132
129
  # and those units for which renewal rates have been manually generated and accepted.
133
130
  #
134
- # @param [String] client_name the YieldStar client name
135
131
  # @param [String] external_property_id the ID of the property where the unit is located
136
132
  # @param [String] unit_number the unit_number that identifies the available unit
137
133
  # @param [Hash] opts optional filters for lease term data
@@ -143,11 +139,10 @@ module YieldStarClient
143
139
  # @return [Array<YieldStarClient::RenewalLeaseTermRent>] the list of units up for renewal
144
140
  #
145
141
  # @raise {see #get_lease_term_rent}
146
- def get_renewal_lease_term_rent(client_name, external_property_id, unit_number, opts={})
142
+ def get_renewal_lease_term_rent(external_property_id, unit_number, opts={})
147
143
  opts ||= {}
148
- call_lease_term_rent_method(client_name,
149
- external_property_id,
150
- unit_number,
144
+ call_lease_term_rent_method(external_property_id,
145
+ unit_number,
151
146
  opts.merge(:request_element => :renewal_lease_term_rent_unit_request,
152
147
  :soap_action => :get_renewal_lease_term_rent,
153
148
  :response_element => :renewal_lease_term_rent_unit_response,
@@ -155,9 +150,9 @@ module YieldStarClient
155
150
  end
156
151
 
157
152
  private
158
- def call_lease_term_rent_method(client_name, external_property_id, unit_number, opts={})
159
- validate_client_name!(client_name)
153
+ def call_lease_term_rent_method(external_property_id, unit_number, opts={})
160
154
  validate_external_property_id!(external_property_id)
155
+ validate_required!(:unit_number=>unit_number)
161
156
 
162
157
  request_opts = opts.merge(:unit_number => unit_number)
163
158
  request_opts.delete_if { |k,v| [:request_element, :soap_action, :response_element, :result_class].include?(k) }
@@ -63,7 +63,6 @@ module YieldStarClient
63
63
 
64
64
  # Retrieves all properties for a client.
65
65
  #
66
- # @param [String] client_name the YieldStar client name
67
66
  # @return [Array<YieldStarClient::Property>] list of properties
68
67
  #
69
68
  # @raise [ArgumentError] when client_name is missing or invalid
@@ -71,10 +70,8 @@ module YieldStarClient
71
70
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
72
71
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
73
72
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
74
- def get_properties(client_name)
75
- validate_client_name!(client_name)
76
-
77
- response = send_soap_request(:get_properties, :client_name => client_name)
73
+ def get_properties
74
+ response = send_soap_request(:get_properties)
78
75
 
79
76
  props = response.to_hash[:get_properties_response][:return][:property] || []
80
77
  props = [props].flatten
@@ -83,7 +80,6 @@ module YieldStarClient
83
80
 
84
81
  # Retrieves information for a specific property.
85
82
  #
86
- # @param [String] client_name the name of the client to perform the request for
87
83
  # @param [String] external_property_id the ID of the property to obtain information for
88
84
  # @return [YieldStarClient::Property] the property data
89
85
  #
@@ -92,11 +88,10 @@ module YieldStarClient
92
88
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
93
89
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
94
90
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
95
- def get_property(client_name, external_property_id)
96
- validate_client_name!(client_name)
91
+ def get_property(external_property_id)
97
92
  validate_external_property_id!(external_property_id)
98
93
 
99
- response = send_soap_request(:get_property, :client_name => client_name, :external_property_id => external_property_id)
94
+ response = send_soap_request(:get_property, :external_property_id => external_property_id)
100
95
 
101
96
  property = response.to_hash[:get_property_response][:return][:property]
102
97
  Property.new(property)
@@ -105,7 +100,6 @@ module YieldStarClient
105
100
 
106
101
  # Retrieves pricing parameters for a specific property.
107
102
  #
108
- # @param [String] client_name the name of the client to perform the request for
109
103
  # @param [String] external_property_id the ID of the property to obtain information for
110
104
  # @return [YieldStarClient::PropertyParameters] the pricing data
111
105
  #
@@ -114,12 +108,10 @@ module YieldStarClient
114
108
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
115
109
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
116
110
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
117
- def get_property_parameters(client_name, external_property_id)
118
- validate_client_name!(client_name)
111
+ def get_property_parameters(external_property_id)
119
112
  validate_external_property_id!(external_property_id)
120
113
 
121
- response = send_soap_request(:get_property_parameters, :client_name => client_name,
122
- :external_property_id => external_property_id)
114
+ response = send_soap_request(:get_property_parameters, :external_property_id => external_property_id)
123
115
 
124
116
  response_hash = response.to_hash[:get_property_parameters_response][:return]
125
117
  param_hash = { :external_property_id => response_hash[:external_property_id] }
@@ -118,7 +118,6 @@ module YieldStarClient
118
118
  # Retrieves high-level rent information for all currently available floor
119
119
  # plans within a specific property.
120
120
  #
121
- # @param [String] client_name the YieldStar client name
122
121
  # @param [String] external_property_id the ID of the property associated
123
122
  # with the requested data
124
123
  #
@@ -129,12 +128,10 @@ module YieldStarClient
129
128
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
130
129
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
131
130
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
132
- def get_rent_summary(client_name, external_property_id)
133
- validate_client_name!(client_name)
131
+ def get_rent_summary(external_property_id)
134
132
  validate_external_property_id!(external_property_id)
135
133
 
136
- response = send_soap_request(:get_rent_summary, :client_name => client_name,
137
- :external_property_id => external_property_id)
134
+ response = send_soap_request(:get_rent_summary, :external_property_id => external_property_id)
138
135
 
139
136
  data = response.to_hash[:get_rent_summary_response][:return]
140
137
  shared_props = {:external_property_id => data[:external_property_id],
@@ -148,7 +145,6 @@ module YieldStarClient
148
145
  # Retrieves rental information for all currently available units at a specific
149
146
  # property, grouped by floor plan.
150
147
  #
151
- # @param [String] client_name the YieldStar client name
152
148
  # @param [String] external_property_id the ID of the property where the available
153
149
  # units are located
154
150
  #
@@ -160,12 +156,10 @@ module YieldStarClient
160
156
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
161
157
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
162
158
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
163
- def get_available_units(client_name, external_property_id)
164
- validate_client_name!(client_name)
159
+ def get_available_units(external_property_id)
165
160
  validate_external_property_id!(external_property_id)
166
161
 
167
- response = send_soap_request(:get_available_units, :client_name => client_name,
168
- :external_property_id => external_property_id)
162
+ response = send_soap_request(:get_available_units, :external_property_id => external_property_id)
169
163
 
170
164
  data = response.to_hash[:get_available_units_response][:return]
171
165
  base_props = data.reject { |k,v| ![:external_property_id, :effective_date].include?(k) }
@@ -39,7 +39,6 @@ module YieldStarClient
39
39
  include Validations
40
40
  # Retrieves data about a specific unit.
41
41
  #
42
- # @param [String] client_name the YieldStar client name
43
42
  # @param [String] external_property_id the ID of the property where the unit is located
44
43
  # @param [String] unit_name the name of the unit to retrieve
45
44
  # @param [optional,String] building_name the name of the building in which the unit is located
@@ -51,12 +50,11 @@ module YieldStarClient
51
50
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
52
51
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
53
52
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
54
- def get_unit(client_name, external_property_id, unit_name, building_name=nil)
55
- validate_client_name!(client_name)
53
+ def get_unit(external_property_id, unit_name, building_name=nil)
56
54
  validate_external_property_id!(external_property_id)
57
55
  validate_required!(:unit_name => unit_name)
58
56
 
59
- body = {:client_name => client_name, :external_property_id => external_property_id, :name => unit_name}
57
+ body = {:external_property_id => external_property_id, :name => unit_name}
60
58
  body[:building] = building_name if building_name
61
59
 
62
60
  response = send_soap_request(:get_unit, body)
@@ -67,8 +65,6 @@ module YieldStarClient
67
65
 
68
66
  # Retrieves all units for a specific property, optionally filtered by floor plan.
69
67
  #
70
- # @param [String] client_name the YieldStar client name
71
- # @param [String] external_property_id the ID of the property where the units are located
72
68
  # @param [optional,String] floor_plan_name the name of the floor plan associated with the units
73
69
  #
74
70
  # @return [Array<Unit>] a list of unit data
@@ -78,11 +74,10 @@ module YieldStarClient
78
74
  # @raise [YieldStarClient::OperationError] when the service raises an OperationError fault
79
75
  # @raise [YieldStarClient::InternalError] when the service raises an InternalError fault
80
76
  # @raise [YieldStarClient::ServerError] when any other server-side error occurs
81
- def get_units(client_name, external_property_id, floor_plan_name=nil)
82
- validate_client_name!(client_name)
77
+ def get_units(external_property_id, floor_plan_name=nil)
83
78
  validate_external_property_id!(external_property_id)
84
79
 
85
- body = {:client_name => client_name, :external_property_id => external_property_id}
80
+ body = {:external_property_id => external_property_id}
86
81
  body[:floor_plan_name] = floor_plan_name if floor_plan_name
87
82
  response = send_soap_request(:get_units, body)
88
83
 
@@ -1,3 +1,3 @@
1
1
  module YieldStarClient
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,72 +1,8 @@
1
- module YieldStarClient
2
- autoload :Configlet, 'configlet'
3
- extend Configlet
4
-
5
- # All valid configuration options.
6
- #
7
- # @see YieldStarClient.configure
8
- VALID_CONFIG_OPTIONS = [:endpoint, :username, :password, :namespace]
9
-
10
- DEFAULT_ENDPOINT = 'https://rmsws.yieldstar.com/rmsws/AppExchange'
11
- DEFAULT_NAMESPACE = 'http://yieldstar.com/ws/AppExchange/v1'
12
-
13
- # Default configuration - happens whether or not .configure is called
14
- config :yield_star do
15
- default :endpoint => DEFAULT_ENDPOINT
16
- default :namespace => DEFAULT_NAMESPACE
17
- end
18
-
19
- # Mutators and accessors for configuration options
20
- class << self
21
- VALID_CONFIG_OPTIONS.each do |config_opt|
22
- define_method(config_opt) do
23
- YieldStarClient[config_opt]
24
- end
1
+ require 'yield_star_client/version'
2
+ require 'yield_star_client/configuration'
25
3
 
26
- define_method("#{config_opt}=".to_sym) do |val|
27
- YieldStarClient[config_opt] = val
28
- end
29
- end
30
- end
31
-
32
- # Configures this module through the given +block+.
33
- # Default configuration options will be applied unless
34
- # they are explicitly overridden in the +block+.
35
- #
36
- # @yield [_self] configures service connection options
37
- # @yieldparam [YieldstarClient] _self the object on which the configure method was called
38
- # @example Typical case utilizing defaults
39
- # YieldStarClient.configure do |config|
40
- # config.username = 'my_user'
41
- # config.password = 'my_pass'
42
- # end
43
- # @example Overriding defaults
44
- # YieldStarClient.configure do |config|
45
- # config.username = 'my_user'
46
- # config.password = 'my_pass'
47
- # config.endpoint = 'http://my.endpoint.com'
48
- # config.namespace = 'http://my.namespace.com'
49
- # end
50
- # @return [YieldStarClient] _self
51
- # @see VALID_CONFIG_OPTIONS
52
- def self.configure
53
- config :yield_star do
54
- yield self
55
- end
56
-
57
- self
58
- end
59
-
60
- # Resets this module's configuration.
61
- # Configuration options will be set to default values
62
- # if they exist; otherwise, they will be set to nil.
63
- #
64
- # @see VALID_CONFIG_OPTIONS
65
- # @see DEFAULT_ENDPOINT
66
- # @see DEFAULT_NAMESPACE
67
- def self.reset
68
- VALID_CONFIG_OPTIONS.each { |opt| self.send("#{opt}=", nil) }
69
- end
4
+ module YieldStarClient
5
+ extend Configuration
70
6
 
71
7
  require 'yield_star_client/client'
72
8
  end
data/spec/spec_helper.rb CHANGED
@@ -4,9 +4,6 @@ Bundler.require :default, :development
4
4
  Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each { |f| require f }
5
5
 
6
6
  Savon::Spec::Fixture.path = File.expand_path("../fixtures", __FILE__)
7
- Savon.configure do |config|
8
- config.log = false
9
- end
10
7
 
11
8
  RSpec.configure do |config|
12
9
  config.include WebMock::API
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "amenity methods" do
4
4
  subject { test_object }
5
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint') }
5
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
6
6
 
7
7
  let(:client_name) { 'my_client_name' }
8
8
  let(:external_property_id) { 'my_prop_id' }
@@ -14,7 +14,7 @@ describe "amenity methods" do
14
14
  before { savon.stubs(:get_floor_plan_amenities).returns(nil) }
15
15
 
16
16
  subject { amenities }
17
- let(:amenities) { test_object.get_floor_plan_amenities(client_name, external_property_id, floor_plan_name) }
17
+ let(:amenities) { test_object.get_floor_plan_amenities(external_property_id, floor_plan_name) }
18
18
  let(:floor_plan_name) { 'my_floor_plan' }
19
19
 
20
20
  it "should retrieve the amenity data from the service" do
@@ -73,12 +73,12 @@ describe "amenity methods" do
73
73
 
74
74
  subject { amenities }
75
75
 
76
- let(:amenities) { test_object.get_unit_amenities(client_name, external_property_id, unit_name, building) }
76
+ let(:amenities) { test_object.get_unit_amenities(external_property_id, unit_name, building) }
77
77
  let(:unit_name) { 'my_unit_name' }
78
78
  let(:building) { 'my_building' }
79
79
 
80
80
  context "without a building" do
81
- let(:amenities) { test_object.get_unit_amenities(client_name, external_property_id, unit_name) }
81
+ let(:amenities) { test_object.get_unit_amenities(external_property_id, unit_name) }
82
82
  let(:soap_body) do
83
83
  {:client_name => client_name,
84
84
  :external_property_id => external_property_id,
@@ -152,7 +152,7 @@ describe "amenity methods" do
152
152
 
153
153
  context "when there is no building" do
154
154
  before { savon.stubs(:get_unit_amenities).returns(:no_amenities) }
155
- let(:amenities) { test_object.get_unit_amenities(client_name, external_property_id, unit_name) }
155
+ let(:amenities) { test_object.get_unit_amenities(external_property_id, unit_name) }
156
156
 
157
157
  it "should not raise an error" do
158
158
  expect { subject }.to_not raise_error
@@ -4,12 +4,19 @@ describe YieldStarClient::Client do
4
4
  subject { client }
5
5
 
6
6
  after { YieldStarClient.reset }
7
+ after do
8
+ Savon.log = nil
9
+ Savon.logger = nil
10
+ end
7
11
 
8
12
  let(:client) do
9
- YieldStarClient::Client.new({:endpoint => endpoint,
10
- :username => username,
13
+ YieldStarClient::Client.new({:endpoint => endpoint,
14
+ :username => username,
11
15
  :password => password,
12
- :namespace => namespace})
16
+ :namespace => namespace,
17
+ :client_name => client_name,
18
+ :debug => debug,
19
+ :logger => logger})
13
20
  end
14
21
 
15
22
  let(:endpoint) { 'https://foo.com?wsdl' }
@@ -17,11 +24,17 @@ describe YieldStarClient::Client do
17
24
  let(:username) { 'test_user' }
18
25
  let(:password) { 'secret' }
19
26
  let(:namespace) { 'http://foo.com/namespace' }
27
+ let(:client_name) { 'test_client' }
28
+ let(:debug) { true }
29
+ let(:logger) { mock() }
20
30
 
21
31
  its(:endpoint) { should == endpoint }
22
32
  its(:username) { should == username }
23
33
  its(:password) { should == password }
24
34
  its(:namespace) { should == namespace }
35
+ its(:client_name) { should == client_name }
36
+ its(:debug) { should == debug }
37
+ it { should be_debug }
25
38
 
26
39
  # Methods from the PropertyMethods mixin
27
40
  # The actual tests for these are in property_methods_spec
@@ -59,6 +72,9 @@ describe YieldStarClient::Client do
59
72
  its(:username) { should_not be }
60
73
  its(:password) { should_not be }
61
74
  its(:namespace) { should == YieldStarClient::DEFAULT_NAMESPACE }
75
+ its(:client_name) { should_not be }
76
+ its(:logger) { should be_a Logger }
77
+ it { should_not be_debug }
62
78
  end
63
79
 
64
80
  describe "#endpoint=" do
@@ -147,4 +163,138 @@ describe YieldStarClient::Client do
147
163
  end
148
164
  end
149
165
  end
166
+
167
+ describe "#debug=" do
168
+ subject { client.debug = new_debug }
169
+
170
+ context 'with a boolean value' do
171
+ let(:debug) { false }
172
+ let(:new_debug) { true }
173
+
174
+ it 'should change the debug setting' do
175
+ expect { subject }.to change { client.debug? }.from(debug).to(new_debug)
176
+ end
177
+
178
+ it 'should enable logging in savon' do
179
+ expect { subject }.to change { Savon.log? }.from(client.debug).to(new_debug)
180
+ end
181
+ end
182
+
183
+ context 'with nil' do
184
+ let(:debug) { false }
185
+ let(:new_debug) { nil }
186
+
187
+ context 'when debug logging is enabled globally' do
188
+ before do
189
+ YieldStarClient.configure { |config| config.debug = true }
190
+ end
191
+
192
+ it 'should enable debug logging' do
193
+ expect { subject }.to change { client.debug? }.from(false).to(true)
194
+ end
195
+
196
+ it 'should enable logging in savon' do
197
+ expect { subject }.to change { Savon.log? }.from(client.debug?).to(true)
198
+ end
199
+ end
200
+
201
+ context 'when debug logging is disabled globally' do
202
+ let(:debug) { true }
203
+ before do
204
+ YieldStarClient.configure { |config| config.debug = false }
205
+ end
206
+
207
+ it 'should disable debug logging' do
208
+ expect { subject }.to change { client.debug? }.from(true).to(false)
209
+ end
210
+
211
+ it 'should disable logging in savon' do
212
+ expect { subject }.to change { Savon.log? }.from(true).to(false)
213
+ end
214
+ end
215
+ end
216
+ end
217
+
218
+ describe "#logger=" do
219
+ subject { client.logger = new_logger }
220
+
221
+ context 'with nil' do
222
+ let(:new_logger) { nil }
223
+ context 'when there is a logger configured globally' do
224
+ let(:global_logger) { mock() }
225
+
226
+ before do
227
+ YieldStarClient.configure { |config| config.logger = global_logger }
228
+ end
229
+
230
+ it 'should set the logger to the global logger' do
231
+ subject
232
+ client.logger.should == global_logger
233
+ end
234
+
235
+ it 'should set the savon logger to the global logger' do
236
+ subject
237
+ Savon.logger.should == global_logger
238
+ end
239
+ end
240
+
241
+ context 'when there is no logger configured globally' do
242
+ it 'should set the logger to the default' do
243
+ subject
244
+ client.logger.should be_an_instance_of(Logger)
245
+ end
246
+
247
+ it 'should change the logger setting in savon' do
248
+ subject
249
+ Savon.logger.should be_an_instance_of(Logger)
250
+ end
251
+ end
252
+ end
253
+
254
+ context 'with custom logger' do
255
+ let(:new_logger) { mock() }
256
+
257
+ it 'should change the logger' do
258
+ expect { subject }.to change { client.logger }.to(new_logger)
259
+ end
260
+
261
+ it 'should change the logger setting in savon' do
262
+ expect { subject }.to change { Savon.logger }.to(new_logger)
263
+ end
264
+ end
265
+ end
266
+
267
+ describe '#client_name=' do
268
+ subject { client.client_name = new_client_name }
269
+
270
+ context 'with nil' do
271
+ let(:new_client_name) { nil }
272
+
273
+ context 'when there is a client_name configured globally' do
274
+ let(:global_client_name) { 'global_client' }
275
+
276
+ before do
277
+ YieldStarClient.configure { |config| config.client_name = global_client_name }
278
+ end
279
+
280
+ it 'should change the client name to match the global configuration' do
281
+ expect { subject }.to change { client.client_name }.from(client_name).to(global_client_name)
282
+ end
283
+ end
284
+
285
+ context 'when there is no client_name configured globally' do
286
+ it 'should reset the client name' do
287
+ expect { subject }.to change { client.client_name }.from(client_name).to(nil)
288
+ end
289
+ end
290
+ end
291
+
292
+ context 'with client name' do
293
+ let(:new_client_name) { 'Some new client name' }
294
+
295
+ it 'should change the client_name' do
296
+ expect { subject }.to change { client.client_name }.from(client_name).to(new_client_name)
297
+ end
298
+ end
299
+ end
150
300
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "floor plan methods" do
4
4
  subject { test_object }
5
5
 
6
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint') }
6
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
7
7
 
8
8
  let(:client_name) { 'my_client_name' }
9
9
  let(:external_property_id) { 'my_external_property_id' }
@@ -14,7 +14,7 @@ describe "floor plan methods" do
14
14
  before { savon.stubs(:get_floor_plan).returns(nil) }
15
15
 
16
16
  subject { floor_plan }
17
- let(:floor_plan) { test_object.get_floor_plan(client_name, external_property_id, floor_plan_name) }
17
+ let(:floor_plan) { test_object.get_floor_plan(external_property_id, floor_plan_name) }
18
18
  let(:floor_plan_name) { 'my_floor_plan_name' }
19
19
 
20
20
  it "should retrieve the floor plan data from the service" do
@@ -58,7 +58,7 @@ describe "floor plan methods" do
58
58
  before { savon.stubs(:get_floor_plans).returns(nil) }
59
59
 
60
60
  subject { floor_plans }
61
- let(:floor_plans) { test_object.get_floor_plans(client_name, external_property_id) }
61
+ let(:floor_plans) { test_object.get_floor_plans(external_property_id) }
62
62
 
63
63
  it "should retrieve the floor plan data from the service" do
64
64
  savon.expects(:get_floor_plans).
@@ -80,7 +80,7 @@ end
80
80
 
81
81
  describe "lease term rent methods" do
82
82
  subject { test_object }
83
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint' ) }
83
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
84
84
 
85
85
  let(:client_name) { 'my_client' }
86
86
  let(:external_property_id) { '42' }
@@ -92,7 +92,7 @@ describe "lease term rent methods" do
92
92
  before { savon.stubs(:get_lease_term_rent).returns(nil) }
93
93
 
94
94
  subject { unit_rates }
95
- let(:unit_rates) { test_object.get_lease_term_rent(client_name, external_property_id, unit_number, opts) }
95
+ let(:unit_rates) { test_object.get_lease_term_rent(external_property_id, unit_number, opts) }
96
96
  let(:opts) { {} }
97
97
 
98
98
  it_should_behave_like 'a lease_term_rent service caller', :get_lease_term_rent
@@ -181,7 +181,7 @@ describe "lease term rent methods" do
181
181
  before { savon.stubs(:get_lease_term_rent_plus).returns(nil) }
182
182
 
183
183
  subject { unit_rates }
184
- let(:unit_rates) { test_object.get_lease_term_rent_plus(client_name, external_property_id, unit_number, opts) }
184
+ let(:unit_rates) { test_object.get_lease_term_rent_plus(external_property_id, unit_number, opts) }
185
185
  let(:opts) { {} }
186
186
 
187
187
  it_should_behave_like 'a lease_term_rent service caller', :get_lease_term_rent_plus
@@ -272,7 +272,7 @@ describe "lease term rent methods" do
272
272
  before { savon.stubs(:get_renewal_lease_term_rent).returns(nil) }
273
273
 
274
274
  subject { unit_rates }
275
- let(:unit_rates) { test_object.get_renewal_lease_term_rent(client_name, external_property_id, unit_number, opts) }
275
+ let(:unit_rates) { test_object.get_renewal_lease_term_rent(external_property_id, unit_number, opts) }
276
276
 
277
277
  let(:opts) { Hash.new }
278
278
 
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "property methods" do
4
4
  subject { test_object }
5
5
 
6
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint') }
6
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
7
7
 
8
8
  let(:client_name) { 'my client name' }
9
9
  let(:external_property_id) { 'my-external-property-id' }
@@ -16,7 +16,7 @@ describe "property methods" do
16
16
  before { savon.stubs(:get_properties).returns(nil) }
17
17
 
18
18
  subject { properties }
19
- let(:properties) { test_object.get_properties(client_name) }
19
+ let(:properties) { test_object.get_properties }
20
20
 
21
21
  it "should retrieve the property data by client_name from the service" do
22
22
  savon.expects(:get_properties).with(:request => {:client_name => client_name}).returns(:single_property)
@@ -94,7 +94,7 @@ describe "property methods" do
94
94
  before { savon.stubs(:get_property).returns(nil) }
95
95
 
96
96
  subject { property }
97
- let(:property) { test_object.get_property(client_name, external_property_id) }
97
+ let(:property) { test_object.get_property(external_property_id) }
98
98
 
99
99
  it "should retrieve the property data from the service" do
100
100
  savon.expects(:get_property).
@@ -140,7 +140,7 @@ describe "property methods" do
140
140
  before { savon.stubs(:get_property_parameters).returns(nil) }
141
141
 
142
142
  subject { parameters }
143
- let(:parameters) { test_object.get_property_parameters(client_name, external_property_id) }
143
+ let(:parameters) { test_object.get_property_parameters(external_property_id) }
144
144
 
145
145
  it "should retrieve the data from the service" do
146
146
  savon.expects(:get_property_parameters).
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "rental/availability methods" do
4
4
  subject { test_object }
5
5
 
6
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint') }
6
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
7
7
 
8
8
  let(:client_name) { 'my_client_name' }
9
9
  let(:external_property_id) { '42' }
@@ -14,7 +14,7 @@ describe "rental/availability methods" do
14
14
  before { savon.stubs(:get_rent_summary).returns(nil) }
15
15
 
16
16
  subject { rent_summaries }
17
- let(:rent_summaries) { test_object.get_rent_summary(client_name, external_property_id) }
17
+ let(:rent_summaries) { test_object.get_rent_summary(external_property_id) }
18
18
 
19
19
  it "should retrieve the data from the service" do
20
20
  savon.expects(:get_rent_summary).
@@ -118,7 +118,7 @@ describe "rental/availability methods" do
118
118
  before { savon.stubs(:get_available_units).returns(nil) }
119
119
 
120
120
  subject { available_floor_plans }
121
- let(:available_floor_plans) { test_object.get_available_units(client_name, external_property_id) }
121
+ let(:available_floor_plans) { test_object.get_available_units(external_property_id) }
122
122
 
123
123
  it "should retrieve the data from the service" do
124
124
  savon.expects(:get_available_units).
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "unit methods" do
4
4
  subject { test_object }
5
5
 
6
- let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint') }
6
+ let(:test_object) { YieldStarClient::Client.new(:endpoint => 'http://bogusendpoint', :client_name => client_name) }
7
7
 
8
8
  let(:client_name) { 'my_client_name' }
9
9
  let(:external_property_id) { 'my_prop_id' }
@@ -15,7 +15,7 @@ describe "unit methods" do
15
15
  before { savon.stubs(:get_unit).returns(nil) }
16
16
 
17
17
  subject { unit }
18
- let(:unit) { test_object.get_unit(client_name, external_property_id, unit_name) }
18
+ let(:unit) { test_object.get_unit(external_property_id, unit_name) }
19
19
  let(:unit_name) { 'my_unit_name' }
20
20
  let(:soap_body) { {:client_name => client_name, :external_property_id => external_property_id, :name => unit_name}}
21
21
 
@@ -27,7 +27,7 @@ describe "unit methods" do
27
27
  end
28
28
 
29
29
  context "with a building name" do
30
- let(:unit) { test_object.get_unit(client_name, external_property_id, unit_name, building_name) }
30
+ let(:unit) { test_object.get_unit(external_property_id, unit_name, building_name) }
31
31
  let(:building_name) { 'my_building' }
32
32
 
33
33
  it "should retrieve the data from the service" do
@@ -76,7 +76,7 @@ describe "unit methods" do
76
76
  before { savon.stubs(:get_units).returns(nil) }
77
77
 
78
78
  subject { units }
79
- let(:units) { test_object.get_units(client_name, external_property_id) }
79
+ let(:units) { test_object.get_units(external_property_id) }
80
80
  let(:soap_body) { {:client_name => client_name, :external_property_id => external_property_id} }
81
81
 
82
82
  context "without a floor_plan name" do
@@ -87,7 +87,7 @@ describe "unit methods" do
87
87
  end
88
88
 
89
89
  context "with a floor_plan name" do
90
- let(:units) { test_object.get_units(client_name, external_property_id, floor_plan_name) }
90
+ let(:units) { test_object.get_units(external_property_id, floor_plan_name) }
91
91
  let(:floor_plan_name) { 'my_floor_plan' }
92
92
 
93
93
  it "should retrieve the data from the service" do
@@ -8,6 +8,7 @@ describe YieldStarClient do
8
8
  let(:username) { 'configured user' }
9
9
  let(:password) { 'configured password' }
10
10
  let(:namespace) { 'http://configured.namespace.com' }
11
+ let(:client_name) { 'configured client name' }
11
12
 
12
13
  after { YieldStarClient.reset }
13
14
 
@@ -20,11 +21,16 @@ describe YieldStarClient do
20
21
  its(:username) { should_not be }
21
22
  its(:password) { should_not be }
22
23
  its(:namespace) { should == default_namespace }
24
+ its(:client_name) { should_not be }
25
+ its(:logger) { should be_an_instance_of Logger }
26
+ it { should_not be_debug }
23
27
  end
24
28
 
25
29
  describe ".configure" do
26
30
  subject { YieldStarClient.configure(&config_block) }
27
31
 
32
+ let(:logger) { mock() }
33
+
28
34
  context "with full configuration" do
29
35
  let(:config_block) do
30
36
  lambda do |config|
@@ -32,6 +38,9 @@ describe YieldStarClient do
32
38
  config.username = username
33
39
  config.password = password
34
40
  config.namespace = namespace
41
+ config.client_name = client_name
42
+ config.debug = true
43
+ config.logger = logger
35
44
  end
36
45
  end
37
46
 
@@ -40,6 +49,9 @@ describe YieldStarClient do
40
49
  its(:username) { should == username }
41
50
  its(:password) { should == password }
42
51
  its(:namespace) { should == namespace }
52
+ its(:client_name) { should == client_name }
53
+ it { should be_debug }
54
+ its(:logger) { should == logger }
43
55
  end
44
56
 
45
57
  context "with partial configuration" do
@@ -47,6 +59,8 @@ describe YieldStarClient do
47
59
  lambda do |config|
48
60
  config.username = username
49
61
  config.password = password
62
+ config.client_name = client_name
63
+ config.debug = true
50
64
  end
51
65
  end
52
66
 
@@ -55,6 +69,9 @@ describe YieldStarClient do
55
69
  its(:username) { should == username }
56
70
  its(:password) { should == password }
57
71
  its(:namespace) { should == default_namespace }
72
+ its(:client_name) { should == client_name }
73
+ its(:logger) { should be_an_instance_of Logger }
74
+ it { should be_debug }
58
75
  end
59
76
  end
60
77
 
@@ -65,9 +82,14 @@ describe YieldStarClient do
65
82
  config.username = username
66
83
  config.password = password
67
84
  config.namespace = namespace
85
+ config.client_name = client_name
86
+ config.debug = true
87
+ config.logger = logger
68
88
  end
69
89
  end
70
90
 
91
+ let(:logger) { mock() }
92
+
71
93
  subject { YieldStarClient.reset }
72
94
 
73
95
  it "should change the endpoint to the default" do
@@ -82,8 +104,21 @@ describe YieldStarClient do
82
104
  expect { subject }.to change{YieldStarClient.password}.from(password).to(nil)
83
105
  end
84
106
 
107
+ it "should clear the client_name" do
108
+ expect { subject }.to change{YieldStarClient.client_name}.from(client_name).to(nil)
109
+ end
110
+
85
111
  it "should change the namespace to the default" do
86
112
  expect { subject }.to change{YieldStarClient.namespace}.from(namespace).to(default_namespace)
87
113
  end
114
+
115
+ it "should change the logger to the default" do
116
+ expect { subject }.to change{YieldStarClient.logger}
117
+ YieldStarClient.logger.should be_an_instance_of Logger
118
+ end
119
+
120
+ it "should change the debug setting to the default" do
121
+ expect { subject }.to change{YieldStarClient.debug?}.from(true).to(false)
122
+ end
88
123
  end
89
124
  end
@@ -20,15 +20,13 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency('configlet', '~> 2.1')
23
- s.add_dependency('httpi', '0.7.9') # httpi 0.9.0 broke savon - see http://github.com/rubiii/httpi/issues#issue/25
24
- s.add_dependency('savon', '~> 0.8')
23
+ s.add_dependency('savon', '~> 0.9.7')
25
24
  s.add_dependency('modelish', '>= 0.1.2')
26
25
 
27
- s.add_development_dependency('rspec',"~> 2.4")
26
+ s.add_development_dependency('rspec','~> 2.4')
28
27
  s.add_development_dependency('webmock', '~> 1.6')
29
28
  s.add_development_dependency('yard', '~> 0.6')
30
- s.add_development_dependency('bluecloth','~> 2.0.9')
29
+ s.add_development_dependency('rdiscount', '~>1.6')
31
30
  s.add_development_dependency('savon_spec','~> 0.1')
32
- s.add_development_dependency('autotest', '~> 4.4')
33
31
  s.has_rdoc=true
34
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yield_star_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - G5
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-14 00:00:00 -07:00
18
+ date: 2012-01-16 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,40 +34,25 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: httpi
37
+ name: savon
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - "="
42
+ - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 17
44
+ hash: 53
45
45
  segments:
46
46
  - 0
47
- - 7
48
47
  - 9
49
- version: 0.7.9
48
+ - 7
49
+ version: 0.9.7
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: savon
54
- prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 27
61
- segments:
62
- - 0
63
- - 8
64
- version: "0.8"
65
- type: :runtime
66
- version_requirements: *id003
67
52
  - !ruby/object:Gem::Dependency
68
53
  name: modelish
69
54
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
71
56
  none: false
72
57
  requirements:
73
58
  - - ">="
@@ -79,11 +64,11 @@ dependencies:
79
64
  - 2
80
65
  version: 0.1.2
81
66
  type: :runtime
82
- version_requirements: *id004
67
+ version_requirements: *id003
83
68
  - !ruby/object:Gem::Dependency
84
69
  name: rspec
85
70
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
71
+ requirement: &id004 !ruby/object:Gem::Requirement
87
72
  none: false
88
73
  requirements:
89
74
  - - ~>
@@ -94,11 +79,11 @@ dependencies:
94
79
  - 4
95
80
  version: "2.4"
96
81
  type: :development
97
- version_requirements: *id005
82
+ version_requirements: *id004
98
83
  - !ruby/object:Gem::Dependency
99
84
  name: webmock
100
85
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
102
87
  none: false
103
88
  requirements:
104
89
  - - ~>
@@ -109,11 +94,11 @@ dependencies:
109
94
  - 6
110
95
  version: "1.6"
111
96
  type: :development
112
- version_requirements: *id006
97
+ version_requirements: *id005
113
98
  - !ruby/object:Gem::Dependency
114
99
  name: yard
115
100
  prerelease: false
116
- requirement: &id007 !ruby/object:Gem::Requirement
101
+ requirement: &id006 !ruby/object:Gem::Requirement
117
102
  none: false
118
103
  requirements:
119
104
  - - ~>
@@ -124,27 +109,26 @@ dependencies:
124
109
  - 6
125
110
  version: "0.6"
126
111
  type: :development
127
- version_requirements: *id007
112
+ version_requirements: *id006
128
113
  - !ruby/object:Gem::Dependency
129
- name: bluecloth
114
+ name: rdiscount
130
115
  prerelease: false
131
- requirement: &id008 !ruby/object:Gem::Requirement
116
+ requirement: &id007 !ruby/object:Gem::Requirement
132
117
  none: false
133
118
  requirements:
134
119
  - - ~>
135
120
  - !ruby/object:Gem::Version
136
- hash: 29
121
+ hash: 3
137
122
  segments:
138
- - 2
139
- - 0
140
- - 9
141
- version: 2.0.9
123
+ - 1
124
+ - 6
125
+ version: "1.6"
142
126
  type: :development
143
- version_requirements: *id008
127
+ version_requirements: *id007
144
128
  - !ruby/object:Gem::Dependency
145
129
  name: savon_spec
146
130
  prerelease: false
147
- requirement: &id009 !ruby/object:Gem::Requirement
131
+ requirement: &id008 !ruby/object:Gem::Requirement
148
132
  none: false
149
133
  requirements:
150
134
  - - ~>
@@ -155,22 +139,7 @@ dependencies:
155
139
  - 1
156
140
  version: "0.1"
157
141
  type: :development
158
- version_requirements: *id009
159
- - !ruby/object:Gem::Dependency
160
- name: autotest
161
- prerelease: false
162
- requirement: &id010 !ruby/object:Gem::Requirement
163
- none: false
164
- requirements:
165
- - - ~>
166
- - !ruby/object:Gem::Version
167
- hash: 19
168
- segments:
169
- - 4
170
- - 4
171
- version: "4.4"
172
- type: :development
173
- version_requirements: *id010
142
+ version_requirements: *id008
174
143
  description: A simple wrapper around a SOAP client for the YieldStar AppExchange web service.
175
144
  email:
176
145
  - engineering@g5platform.com
@@ -186,11 +155,13 @@ files:
186
155
  - .rvmrc
187
156
  - CHANGELOG.md
188
157
  - Gemfile
158
+ - LICENSE
189
159
  - README.md
190
160
  - Rakefile
191
161
  - lib/yield_star_client.rb
192
162
  - lib/yield_star_client/amenity_methods.rb
193
163
  - lib/yield_star_client/client.rb
164
+ - lib/yield_star_client/configuration.rb
194
165
  - lib/yield_star_client/errors.rb
195
166
  - lib/yield_star_client/floor_plan_methods.rb
196
167
  - lib/yield_star_client/lease_term_rent_methods.rb