Class: GolfSwitch::GetGolfBooking
- Defined in:
- lib/golf_switch/get_golf_booking.rb
Instance Attribute Summary collapse
-
#booking_id ⇒ Object
Returns the value of attribute booking_id.
-
#confirmation_no ⇒ Object
Returns the value of attribute confirmation_no.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#note ⇒ Object
Returns the value of attribute note.
-
#tee_date ⇒ Object
Returns the value of attribute tee_date.
Attributes inherited from Request
#client, #config, #request, #response, #soap_error
Instance Method Summary collapse
- #commit ⇒ Object
- #get_options ⇒ Object
-
#initialize(course_id, tee_date, confirmation_no = nil, booking_id = nil) ⇒ GetGolfBooking
constructor
A new instance of GetGolfBooking.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(course_id, tee_date, confirmation_no = nil, booking_id = nil) ⇒ GetGolfBooking
Returns a new instance of GetGolfBooking.
5 6 7 8 9 10 |
# File 'lib/golf_switch/get_golf_booking.rb', line 5 def initialize(course_id,tee_date,confirmation_no=nil,booking_id=nil) @course_id = course_id @tee_date = tee_date @confirmation_no = confirmation_no @booking_id = booking_id end |
Instance Attribute Details
#booking_id ⇒ Object
Returns the value of attribute booking_id.
3 4 5 |
# File 'lib/golf_switch/get_golf_booking.rb', line 3 def booking_id @booking_id end |
#confirmation_no ⇒ Object
Returns the value of attribute confirmation_no.
3 4 5 |
# File 'lib/golf_switch/get_golf_booking.rb', line 3 def confirmation_no @confirmation_no end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/golf_switch/get_golf_booking.rb', line 3 def course_id @course_id end |
#note ⇒ Object
Returns the value of attribute note.
3 4 5 |
# File 'lib/golf_switch/get_golf_booking.rb', line 3 def note @note end |
#tee_date ⇒ Object
Returns the value of attribute tee_date.
3 4 5 |
# File 'lib/golf_switch/get_golf_booking.rb', line 3 def tee_date @tee_date end |
Instance Method Details
#commit ⇒ Object
28 29 30 |
# File 'lib/golf_switch/get_golf_booking.rb', line 28 def commit super("get_golf_booking") end |
#get_options ⇒ Object
12 13 14 15 16 17 |
# File 'lib/golf_switch/get_golf_booking.rb', line 12 def { "Req"=> option_attributes } end |
#option_attributes ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/golf_switch/get_golf_booking.rb', line 19 def option_attributes = {} .merge!("CourseId"=>@course_id) .merge!("TeeDate"=>DateTime.parse(@tee_date).strftime("%Y-%m-%dT00:00:00")) .merge!("ConfirmationNo"=>@confirmation_no) unless @confirmation_no.blank? .merge!("BookingId"=>@booking_id) unless @booking_id.blank? end |
#parse_error ⇒ Object
32 33 34 |
# File 'lib/golf_switch/get_golf_booking.rb', line 32 def parse_error @response[:get_golf_booking_response][:get_golf_booking_result] end |
#parse_response ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/golf_switch/get_golf_booking.rb', line 36 def parse_response begin unless error? @api_response = GolfSwitch::GolfBookInfo.new(@response[:get_golf_booking_response][:get_golf_booking_result]) else puts "Error #{}" end rescue puts "Parse Error On Getting golf info Response" end end |