Class: GolfSwitch::GetCoursePolicy
- Defined in:
- lib/golf_switch/get_course_policy.rb
Instance Attribute Summary collapse
-
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
-
#api_response ⇒ Object
Returns the value of attribute api_response.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#play_date ⇒ Object
Returns the value of attribute play_date.
Attributes inherited from Request
#client, #config, #request, #response, #soap_error
Instance Method Summary collapse
- #commit ⇒ Object
- #get_options ⇒ Object
-
#initialize(attributes = {}) ⇒ GetCoursePolicy
constructor
A new instance of GetCoursePolicy.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(attributes = {}) ⇒ GetCoursePolicy
Returns a new instance of GetCoursePolicy.
5 6 7 8 9 10 11 12 13 |
# File 'lib/golf_switch/get_course_policy.rb', line 5 def initialize(attributes={}) attributes.each do |name, value| begin send("#{name}=", value) rescue puts "Add #{name} is not valid" end end end |
Instance Attribute Details
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
3 4 5 |
# File 'lib/golf_switch/get_course_policy.rb', line 3 def alt_rate_type @alt_rate_type end |
#api_response ⇒ Object
Returns the value of attribute api_response.
3 4 5 |
# File 'lib/golf_switch/get_course_policy.rb', line 3 def api_response @api_response end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/golf_switch/get_course_policy.rb', line 3 def course_id @course_id end |
#play_date ⇒ Object
Returns the value of attribute play_date.
3 4 5 |
# File 'lib/golf_switch/get_course_policy.rb', line 3 def play_date @play_date end |
Instance Method Details
#commit ⇒ Object
29 30 31 |
# File 'lib/golf_switch/get_course_policy.rb', line 29 def commit super("get_course_policies") end |
#get_options ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/golf_switch/get_course_policy.rb', line 14 def { "Req"=> option_attributes } end |
#option_attributes ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/golf_switch/get_course_policy.rb', line 21 def option_attributes = {} .merge!("CourseId"=>@course_id) unless @course_id.blank? .merge!("PlayDate"=>DateTime.parse(@play_date).strftime("%Y-%m-%dT00:00:00")) unless @play_date.blank? .merge!("AltRateType"=>@alt_rate_type) unless @alt_rate_type.blank? end |
#parse_error ⇒ Object
33 34 35 |
# File 'lib/golf_switch/get_course_policy.rb', line 33 def parse_error @response[:get_course_policies_response][:get_course_policies_result] end |
#parse_response ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/golf_switch/get_course_policy.rb', line 37 def parse_response begin unless error? @api_response = GolfSwitch::CoursePolicyResponse.new(@response[:get_course_policies_response][:get_course_policies_result]) else puts "Error #{}" end rescue puts "Parse Error On Getting golf info Response" end end |