Class: GolfSwitch::CourseAvailList
- Defined in:
- lib/golf_switch/course_avail_list.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.
-
#area ⇒ Object
Returns the value of attribute area.
-
#barter_only ⇒ Object
Returns the value of attribute barter_only.
-
#charging_only ⇒ Object
Returns the value of attribute charging_only.
-
#country_id ⇒ Object
Returns the value of attribute country_id.
-
#featured_only ⇒ Object
Returns the value of attribute featured_only.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#max_distance ⇒ Object
Returns the value of attribute max_distance.
-
#max_distance_type ⇒ Object
Returns the value of attribute max_distance_type.
-
#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.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#profile_id ⇒ Object
Returns the value of attribute profile_id.
-
#promo_code ⇒ Object
Returns the value of attribute promo_code.
-
#region_id ⇒ Object
Returns the value of attribute region_id.
-
#regular_rate_only ⇒ Object
Returns the value of attribute regular_rate_only.
-
#show_all_times ⇒ Object
Returns the value of attribute show_all_times.
-
#show_if_no_times ⇒ Object
Returns the value of attribute show_if_no_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 = {}) ⇒ CourseAvailList
constructor
play_beg_date,play_end_date is “yyyy-mm-dd” format Time HHMM format.
- #option_attributes ⇒ Object
- #parse_error ⇒ Object
- #parse_response ⇒ Object
Methods inherited from Request
#error?, #error_message, #get_authentication_header
Constructor Details
#initialize(attributes = {}) ⇒ CourseAvailList
play_beg_date,play_end_date is “yyyy-mm-dd” format Time HHMM format
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/golf_switch/course_avail_list.rb', line 10 def initialize(attributes = {}) attributes.each do |name, value| begin send("#{name}=", value) end end @max_distance_type = "M" unless ["M","K"].include?(@max_distance_type) @country_id ||= "USA" @play_end_date||= @play_beg_date end |
Instance Attribute Details
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def alt_rate_type @alt_rate_type end |
#api_response ⇒ Object
Returns the value of attribute api_response.
7 8 9 |
# File 'lib/golf_switch/course_avail_list.rb', line 7 def api_response @api_response end |
#area ⇒ Object
Returns the value of attribute area.
3 4 5 |
# File 'lib/golf_switch/course_avail_list.rb', line 3 def area @area end |
#barter_only ⇒ Object
Returns the value of attribute barter_only.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def @barter_only end |
#charging_only ⇒ Object
Returns the value of attribute charging_only.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def charging_only @charging_only end |
#country_id ⇒ Object
Returns the value of attribute country_id.
3 4 5 |
# File 'lib/golf_switch/course_avail_list.rb', line 3 def country_id @country_id end |
#featured_only ⇒ Object
Returns the value of attribute featured_only.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def featured_only @featured_only end |
#latitude ⇒ Object
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def longitude @longitude end |
#max_distance ⇒ Object
Returns the value of attribute max_distance.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def max_distance @max_distance end |
#max_distance_type ⇒ Object
Returns the value of attribute max_distance_type.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def max_distance_type @max_distance_type end |
#play_beg_date ⇒ Object
Returns the value of attribute play_beg_date.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def play_beg_date @play_beg_date end |
#play_end_date ⇒ Object
Returns the value of attribute play_end_date.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def play_end_date @play_end_date end |
#players ⇒ Object
Returns the value of attribute players.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def players @players end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
5 6 7 |
# File 'lib/golf_switch/course_avail_list.rb', line 5 def postal_code @postal_code end |
#profile_id ⇒ Object
Returns the value of attribute profile_id.
7 8 9 |
# File 'lib/golf_switch/course_avail_list.rb', line 7 def profile_id @profile_id end |
#promo_code ⇒ Object
Returns the value of attribute promo_code.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def promo_code @promo_code end |
#region_id ⇒ Object
Returns the value of attribute region_id.
3 4 5 |
# File 'lib/golf_switch/course_avail_list.rb', line 3 def region_id @region_id end |
#regular_rate_only ⇒ Object
Returns the value of attribute regular_rate_only.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def regular_rate_only @regular_rate_only end |
#show_all_times ⇒ Object
Returns the value of attribute show_all_times.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def show_all_times @show_all_times end |
#show_if_no_times ⇒ Object
Returns the value of attribute show_if_no_times.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def show_if_no_times @show_if_no_times end |
#specials_only ⇒ Object
Returns the value of attribute specials_only.
6 7 8 |
# File 'lib/golf_switch/course_avail_list.rb', line 6 def specials_only @specials_only end |
#time ⇒ Object
Returns the value of attribute time.
4 5 6 |
# File 'lib/golf_switch/course_avail_list.rb', line 4 def time @time end |
Instance Method Details
#commit ⇒ Object
63 64 65 |
# File 'lib/golf_switch/course_avail_list.rb', line 63 def commit super("course_avail_list") end |
#get_options ⇒ Object
56 57 58 59 60 61 |
# File 'lib/golf_switch/course_avail_list.rb', line 56 def { "Req"=> option_attributes } end |
#option_attributes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/golf_switch/course_avail_list.rb', line 22 def option_attributes = {} .merge!("CountryId"=>@country_id) unless @country_id.blank? .merge!("RegionId"=>@region_id) unless @region_id.blank? .merge!("Area"=>@area) unless @area.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!("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!("Latitude"=>@latitude) unless @latitude.blank? .merge!("Longitude"=>@longitude) unless @longitude.blank? .merge!("PostalCode"=>@postal_code) unless @postal_code.blank? .merge!("MaxDistance"=>@max_distance) unless @max_distance.blank? .merge!("MaxDistanceType"=>@max_distance_type) if !@max_distance.blank? && !@max_distance_type.blank? .merge!("FeaturedOnly"=>@featured_only) unless @featured_only.blank? .merge!("ShowAllTimes"=>@show_all_times) unless @show_all_times.blank? .merge!("ShowIfNoTimes"=>@show_if_no_times) unless @show_if_no_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
67 68 69 |
# File 'lib/golf_switch/course_avail_list.rb', line 67 def parse_error @response[:course_avail_list_response][:course_avail_list_result] end |
#parse_response ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/golf_switch/course_avail_list.rb', line 71 def parse_response begin unless error? @api_response = AvailableCourse.parse_courses(@response[:course_avail_list_response][:course_avail_list_result]) else puts "Error #{}" end rescue end end |