Class: GolfSwitch::Area
Instance Attribute Summary collapse
-
#api_response ⇒ Object
Returns the value of attribute api_response.
-
#country_id ⇒ Object
Returns the value of attribute country_id.
-
#region_id ⇒ Object
Returns the value of attribute region_id.
Attributes inherited from Request
#client, #config, #request, #response, #soap_error
Instance Method Summary collapse
- #commit ⇒ Object
- #get_options ⇒ Object
-
#initialize(attributes = {}) ⇒ Area
constructor
A new instance of Area.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(attributes = {}) ⇒ Area
Returns a new instance of Area.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/golf_switch/area.rb', line 4 def initialize(attributes = {}) attributes.each do |name, value| begin send("#{name}=", value) rescue puts "invalid attribute #{name} in area" end end @area_response = [] end |
Instance Attribute Details
#api_response ⇒ Object
Returns the value of attribute api_response.
3 4 5 |
# File 'lib/golf_switch/area.rb', line 3 def api_response @api_response end |
#country_id ⇒ Object
Returns the value of attribute country_id.
3 4 5 |
# File 'lib/golf_switch/area.rb', line 3 def country_id @country_id end |
#region_id ⇒ Object
Returns the value of attribute region_id.
3 4 5 |
# File 'lib/golf_switch/area.rb', line 3 def region_id @region_id end |
Instance Method Details
#commit ⇒ Object
31 32 33 |
# File 'lib/golf_switch/area.rb', line 31 def commit super("areas") end |
#get_options ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/golf_switch/area.rb', line 16 def { "Req"=> option_attributes } end |
#option_attributes ⇒ Object
24 25 26 27 28 29 |
# File 'lib/golf_switch/area.rb', line 24 def option_attributes = {} .merge!("CountryId"=>@country_id) unless @country_id.blank? .merge!("RegionId"=>@region_id) unless @region_id.blank? end |
#parse_error ⇒ Object
35 36 37 |
# File 'lib/golf_switch/area.rb', line 35 def parse_error @response[:areas_response][:areas_result] end |
#parse_response ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/golf_switch/area.rb', line 39 def parse_response begin unless error? @api_response = AreaResponse.parse_areas(@response[:areas_response][:areas_result]) else puts "Error #{}" end rescue puts "Parse Error On Area" end end |