Class: GolfSwitch::BookGolfItem
- Inherits:
-
Object
- Object
- GolfSwitch::BookGolfItem
- Defined in:
- lib/golf_switch/book_golf_item.rb
Instance Attribute Summary collapse
-
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
-
#book_notes ⇒ Object
Returns the value of attribute book_notes.
-
#chrg_curr ⇒ Object
Returns the value of attribute chrg_curr.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#curr ⇒ Object
Returns the value of attribute curr.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#ignore_pricing ⇒ Object
Returns the value of attribute ignore_pricing.
-
#num_players ⇒ Object
Returns the value of attribute num_players.
-
#package_id ⇒ Object
Returns the value of attribute package_id.
-
#payment ⇒ Object
Returns the value of attribute payment.
-
#play_date ⇒ Object
Returns the value of attribute play_date.
-
#play_time ⇒ Object
Returns the value of attribute play_time.
-
#players ⇒ Object
Returns the value of attribute players.
-
#pp_charge ⇒ Object
Returns the value of attribute pp_charge.
-
#pp_net_rt ⇒ Object
Returns the value of attribute pp_net_rt.
-
#pp_non_ref ⇒ Object
Returns the value of attribute pp_non_ref.
-
#pp_price ⇒ Object
Returns the value of attribute pp_price.
-
#pp_txn_fee ⇒ Object
Returns the value of attribute pp_txn_fee.
-
#promo_code ⇒ Object
Returns the value of attribute promo_code.
-
#tot_charge ⇒ Object
Returns the value of attribute tot_charge.
-
#tot_net_rt ⇒ Object
Returns the value of attribute tot_net_rt.
-
#tot_non_ref ⇒ Object
Returns the value of attribute tot_non_ref.
-
#tot_price ⇒ Object
Returns the value of attribute tot_price.
-
#tot_txn_fee ⇒ Object
Returns the value of attribute tot_txn_fee.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ BookGolfItem
constructor
A new instance of BookGolfItem.
- #option_attributes ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ BookGolfItem
Returns a new instance of BookGolfItem.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/golf_switch/book_golf_item.rb', line 7 def initialize(attributes={}) attributes.each do |name, value| begin send("#{name}=", value) rescue puts "invalid attribute #{name} in player" end end @players ||=[] end |
Instance Attribute Details
#alt_rate_type ⇒ Object
Returns the value of attribute alt_rate_type.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def alt_rate_type @alt_rate_type end |
#book_notes ⇒ Object
Returns the value of attribute book_notes.
6 7 8 |
# File 'lib/golf_switch/book_golf_item.rb', line 6 def book_notes @book_notes end |
#chrg_curr ⇒ Object
Returns the value of attribute chrg_curr.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def chrg_curr @chrg_curr end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def course_id @course_id end |
#curr ⇒ Object
Returns the value of attribute curr.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def curr @curr end |
#flags ⇒ Object
Returns the value of attribute flags.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def flags @flags end |
#ignore_pricing ⇒ Object
Returns the value of attribute ignore_pricing.
6 7 8 |
# File 'lib/golf_switch/book_golf_item.rb', line 6 def ignore_pricing @ignore_pricing end |
#num_players ⇒ Object
Returns the value of attribute num_players.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def num_players @num_players end |
#package_id ⇒ Object
Returns the value of attribute package_id.
6 7 8 |
# File 'lib/golf_switch/book_golf_item.rb', line 6 def package_id @package_id end |
#payment ⇒ Object
Returns the value of attribute payment.
6 7 8 |
# File 'lib/golf_switch/book_golf_item.rb', line 6 def payment @payment end |
#play_date ⇒ Object
Returns the value of attribute play_date.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def play_date @play_date end |
#play_time ⇒ Object
Returns the value of attribute play_time.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def play_time @play_time end |
#players ⇒ Object
Returns the value of attribute players.
6 7 8 |
# File 'lib/golf_switch/book_golf_item.rb', line 6 def players @players end |
#pp_charge ⇒ Object
Returns the value of attribute pp_charge.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def pp_charge @pp_charge end |
#pp_net_rt ⇒ Object
Returns the value of attribute pp_net_rt.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def pp_net_rt @pp_net_rt end |
#pp_non_ref ⇒ Object
Returns the value of attribute pp_non_ref.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def pp_non_ref @pp_non_ref end |
#pp_price ⇒ Object
Returns the value of attribute pp_price.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def pp_price @pp_price end |
#pp_txn_fee ⇒ Object
Returns the value of attribute pp_txn_fee.
4 5 6 |
# File 'lib/golf_switch/book_golf_item.rb', line 4 def pp_txn_fee @pp_txn_fee end |
#promo_code ⇒ Object
Returns the value of attribute promo_code.
3 4 5 |
# File 'lib/golf_switch/book_golf_item.rb', line 3 def promo_code @promo_code end |
#tot_charge ⇒ Object
Returns the value of attribute tot_charge.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def tot_charge @tot_charge end |
#tot_net_rt ⇒ Object
Returns the value of attribute tot_net_rt.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def tot_net_rt @tot_net_rt end |
#tot_non_ref ⇒ Object
Returns the value of attribute tot_non_ref.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def tot_non_ref @tot_non_ref end |
#tot_price ⇒ Object
Returns the value of attribute tot_price.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def tot_price @tot_price end |
#tot_txn_fee ⇒ Object
Returns the value of attribute tot_txn_fee.
5 6 7 |
# File 'lib/golf_switch/book_golf_item.rb', line 5 def tot_txn_fee @tot_txn_fee end |
Instance Method Details
#option_attributes ⇒ Object
18 19 20 21 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 |
# File 'lib/golf_switch/book_golf_item.rb', line 18 def option_attributes @ignore_pricing =false if @ignore_pricing.blank? = {} .merge!("CourseId"=>@course_id) unless @course_id.blank? .merge!("PlayDate"=>(DateTime.parse(@play_date).strftime("%Y-%m-%dT00:00:00"))) .merge!("PlayTime"=>@play_time) .merge!("NumPlayers"=>@num_players) .merge!("AltRateType"=>@alt_rate_type) unless @alt_rate_type.blank? .merge!("PromoCode"=>@promo_code) unless @promo_code.blank? .merge!("PpPrice"=>@pp_price) .merge!("Curr"=>@curr||"USD") .merge!("PpTxnFee"=>@pp_txn_fee) .merge!("PpCharge"=>@pp_charge) .merge!("ChrgCurr"=>@chrg_curr || "USD") .merge!("PpNonRef"=>@pp_non_ref) .merge!("PpNetRt"=>@pp_net_rt) .merge!("TotPrice"=>@tot_price) .merge!("TotTxnFee"=>@tot_txn_fee) .merge!("TotCharge"=>@tot_charge) .merge!("TotNonRef"=>@tot_non_ref) .merge!("TotNetRt"=>@tot_net_rt) .merge!("Flags"=>@flags) unless @flags.blank? .merge!("PackageId"=>@package_id) unless @package_id.blank? .merge!("BookNotes"=>@book_notes) unless @book_notes.blank? .merge!("IgnorePricing"=>@ignore_pricing) ["Players"]={"Player"=>Array(@players).collect{|x| x.option_attributes}} ["Payments"]={"Payment"=>@payment.option_attributes} end |