Class: GolfSwitch::CourseAvail
- Defined in:
- lib/golf_switch/course_avail.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.
-
#barter_only ⇒ Object
Returns the value of attribute barter_only.
-
#charging_only ⇒ Object
Returns the value of attribute charging_only.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#member_no ⇒ Object
Returns the value of attribute member_no.
-
#member_no2 ⇒ Object
Returns the value of attribute member_no2.
-
#member_no3 ⇒ Object
Returns the value of attribute member_no3.
-
#member_no4 ⇒ Object
Returns the value of attribute member_no4.
-
#play_beg_date ⇒ Object
Returns the value of attribute play_beg_date.
-
#play_end_date ⇒ Object
Returns the value of attribute play_end_date.
-
#players ⇒ Object
Returns the value of attribute players.
-
#profile_id ⇒ Object
Returns the value of attribute profile_id.
-
#promo_code ⇒ Object
Returns the value of attribute promo_code.
-
#regular_rate_only ⇒ Object
Returns the value of attribute regular_rate_only.
-
#show_all_times ⇒ Object
Returns the value of attribute show_all_times.
-
#specials_only ⇒ Object
Returns the value of attribute specials_only.
-
#time ⇒ Object
Returns the value of attribute time.
Attributes inherited from Request
#client, #config, #request, #response, #soap_error
Instance Method Summary collapse
- #commit ⇒ Object
- #get_options ⇒ Object
-
#initialize(attributes = {}) ⇒ CourseAvail
constructor
A new instance of CourseAvail.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(attributes = {}) ⇒ CourseAvail
Returns a new instance of CourseAvail.
7 8 9 10 11 12 13 14 |
# File 'lib/golf_switch/course_avail.rb', line 7 def initialize(attributes = {}) attributes.each do |name, value| begin send("#{name}=", value) end end @play_end_date||= @play_beg_date end |
Instance Attribute Details
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def alt_rate_type @alt_rate_type end |
#api_response ⇒ Object
Returns the value of attribute api_response.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def api_response @api_response end |
#barter_only ⇒ Object
Returns the value of attribute barter_only.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def @barter_only end |
#charging_only ⇒ Object
Returns the value of attribute charging_only.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def charging_only @charging_only end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def course_id @course_id end |
#member_no ⇒ Object
Returns the value of attribute member_no.
4 5 6 |
# File 'lib/golf_switch/course_avail.rb', line 4 def member_no @member_no end |
#member_no2 ⇒ Object
Returns the value of attribute member_no2.
4 5 6 |
# File 'lib/golf_switch/course_avail.rb', line 4 def member_no2 @member_no2 end |
#member_no3 ⇒ Object
Returns the value of attribute member_no3.
4 5 6 |
# File 'lib/golf_switch/course_avail.rb', line 4 def member_no3 @member_no3 end |
#member_no4 ⇒ Object
Returns the value of attribute member_no4.
4 5 6 |
# File 'lib/golf_switch/course_avail.rb', line 4 def member_no4 @member_no4 end |
#play_beg_date ⇒ Object
Returns the value of attribute play_beg_date.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def play_beg_date @play_beg_date end |
#play_end_date ⇒ Object
Returns the value of attribute play_end_date.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def play_end_date @play_end_date end |
#players ⇒ Object
Returns the value of attribute players.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def players @players end |
#profile_id ⇒ Object
Returns the value of attribute profile_id.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def profile_id @profile_id end |
#promo_code ⇒ Object
Returns the value of attribute promo_code.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def promo_code @promo_code end |
#regular_rate_only ⇒ Object
Returns the value of attribute regular_rate_only.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def regular_rate_only @regular_rate_only end |
#show_all_times ⇒ Object
Returns the value of attribute show_all_times.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def show_all_times @show_all_times end |
#specials_only ⇒ Object
Returns the value of attribute specials_only.
5 6 7 |
# File 'lib/golf_switch/course_avail.rb', line 5 def specials_only @specials_only end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/golf_switch/course_avail.rb', line 3 def time @time end |
Instance Method Details
#commit ⇒ Object
40 41 42 |
# File 'lib/golf_switch/course_avail.rb', line 40 def commit super("course_avail") end |
#get_options ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/golf_switch/course_avail.rb', line 44 def { "Req"=>{ "CourseAvailRequest"=>option_attributes } } end |
#option_attributes ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/golf_switch/course_avail.rb', line 16 def option_attributes = {} .merge!("CourseId"=>@course_id) unless @course_id.blank? .merge!("PlayBegDate"=>(DateTime.parse(@play_beg_date).strftime("%Y-%m-%dT00:00:00"))) unless @play_beg_date.blank? .merge!("PlayEndDate"=>(DateTime.parse(@play_end_date).strftime("%Y-%m-%dT00:00:00"))) unless @play_end_date.blank? .merge!("MemberNo"=>@member_no) unless @member_no.blank? .merge!("MemberNo2"=>@member_no2) unless @member_no2.blank? .merge!("MemberNo3"=>@member_no3) unless @member_no3.blank? .merge!("MemberNo4"=>@member_no4) unless @member_no4.blank? .merge!("Time"=>@time) unless @time.blank? .merge!("Players"=>@players) unless @players.blank? .merge!("AltRateType"=>@alt_rate_type) unless @alt_rate_type.blank? .merge!("PromoCode"=>@promo_code) unless @promo_code.blank? .merge!("ShowAllTimes"=>@show_all_times) unless @show_all_times.blank? .merge!("BarterOnly"=>@barter_only) unless @barter_only.blank? .merge!("ChargingOnly"=>@charging_only) unless @charging_only.blank? .merge!("SpecialsOnly"=>@specials_only) unless @specials_only.blank? .merge!("RegularRateOnly"=>@regular_rate_only) unless @regular_rate_only.blank? .merge!("ProfileId"=>@profile_id) unless @profile_id.blank? end |
#parse_error ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/golf_switch/course_avail.rb', line 53 def parse_error begin @response[:course_avail_response][:course_avail_result] rescue "Error on Parsing error messsage" end end |
#parse_response ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/golf_switch/course_avail.rb', line 61 def parse_response begin unless error? @api_response = AvailableCourse.parse_courses(@response[:course_avail_response][:course_avail_result]) else puts "Error #{}" end rescue end end |