Class: GolfSwitch::GolfBook
- Inherits:
-
Object
- Object
- GolfSwitch::GolfBook
- Defined in:
- lib/golf_switch/golf_book.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_email ⇒ Object
Returns the value of attribute course_email.
-
#course_id ⇒ Object
Returns the value of attribute course_id.
-
#course_name ⇒ Object
Returns the value of attribute course_name.
-
#course_note ⇒ Object
Returns the value of attribute course_note.
-
#course_phone ⇒ Object
Returns the value of attribute course_phone.
-
#course_x_id ⇒ Object
Returns the value of attribute course_x_id.
-
#course_xid ⇒ Object
Returns the value of attribute course_xid.
-
#curr_charged ⇒ Object
Returns the value of attribute curr_charged.
-
#curr_greens_fee ⇒ Object
Returns the value of attribute curr_greens_fee.
-
#cxl_policy ⇒ Object
Returns the value of attribute cxl_policy.
-
#img ⇒ Object
Returns the value of attribute img.
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#num_players ⇒ Object
Returns the value of attribute num_players.
-
#on_req ⇒ Object
Returns the value of attribute on_req.
-
#play_date ⇒ Object
Returns the value of attribute play_date.
-
#play_time ⇒ Object
Returns the value of attribute play_time.
-
#rate_policy ⇒ Object
Returns the value of attribute rate_policy.
-
#rc ⇒ Object
Returns the value of attribute rc.
-
#tot_cc_charged ⇒ Object
Returns the value of attribute tot_cc_charged.
-
#tot_golf_pass_rounds ⇒ Object
Returns the value of attribute tot_golf_pass_rounds.
-
#tot_greens_fee ⇒ Object
Returns the value of attribute tot_greens_fee.
-
#tot_non_refundable ⇒ Object
Returns the value of attribute tot_non_refundable.
-
#tot_trans_fee ⇒ Object
Returns the value of attribute tot_trans_fee.
-
#tot_voucher_charged ⇒ Object
Returns the value of attribute tot_voucher_charged.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ GolfBook
constructor
A new instance of GolfBook.
- #to_hash ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ GolfBook
Returns a new instance of GolfBook.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/golf_switch/golf_book.rb', line 9 def initialize(attributes={}) attributes.each do |name, value| begin if name.to_s=="cxl_policy" @cxl_policy = GolfSwitch::CoursePolicy.new(value) else send("#{name}=", value) end rescue puts "Add #{name} as accessor in Golf Book" end end end |
Instance Attribute Details
#booking_id ⇒ Object
Returns the value of attribute booking_id.
5 6 7 |
# File 'lib/golf_switch/golf_book.rb', line 5 def booking_id @booking_id end |
#confirmation_no ⇒ Object
Returns the value of attribute confirmation_no.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def confirmation_no @confirmation_no end |
#course_email ⇒ Object
Returns the value of attribute course_email.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def course_email @course_email end |
#course_id ⇒ Object
Returns the value of attribute course_id.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def course_id @course_id end |
#course_name ⇒ Object
Returns the value of attribute course_name.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def course_name @course_name end |
#course_note ⇒ Object
Returns the value of attribute course_note.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def course_note @course_note end |
#course_phone ⇒ Object
Returns the value of attribute course_phone.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def course_phone @course_phone end |
#course_x_id ⇒ Object
Returns the value of attribute course_x_id.
7 8 9 |
# File 'lib/golf_switch/golf_book.rb', line 7 def course_x_id @course_x_id end |
#course_xid ⇒ Object
Returns the value of attribute course_xid.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def course_xid @course_xid end |
#curr_charged ⇒ Object
Returns the value of attribute curr_charged.
6 7 8 |
# File 'lib/golf_switch/golf_book.rb', line 6 def curr_charged @curr_charged end |
#curr_greens_fee ⇒ Object
Returns the value of attribute curr_greens_fee.
5 6 7 |
# File 'lib/golf_switch/golf_book.rb', line 5 def curr_greens_fee @curr_greens_fee end |
#cxl_policy ⇒ Object
Returns the value of attribute cxl_policy.
7 8 9 |
# File 'lib/golf_switch/golf_book.rb', line 7 def cxl_policy @cxl_policy end |
#img ⇒ Object
Returns the value of attribute img.
7 8 9 |
# File 'lib/golf_switch/golf_book.rb', line 7 def img @img end |
#msg ⇒ Object
Returns the value of attribute msg.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def msg @msg end |
#num_players ⇒ Object
Returns the value of attribute num_players.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def num_players @num_players end |
#on_req ⇒ Object
Returns the value of attribute on_req.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def on_req @on_req end |
#play_date ⇒ Object
Returns the value of attribute play_date.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def play_date @play_date end |
#play_time ⇒ Object
Returns the value of attribute play_time.
4 5 6 |
# File 'lib/golf_switch/golf_book.rb', line 4 def play_time @play_time end |
#rate_policy ⇒ Object
Returns the value of attribute rate_policy.
7 8 9 |
# File 'lib/golf_switch/golf_book.rb', line 7 def rate_policy @rate_policy end |
#rc ⇒ Object
Returns the value of attribute rc.
3 4 5 |
# File 'lib/golf_switch/golf_book.rb', line 3 def rc @rc end |
#tot_cc_charged ⇒ Object
Returns the value of attribute tot_cc_charged.
5 6 7 |
# File 'lib/golf_switch/golf_book.rb', line 5 def tot_cc_charged @tot_cc_charged end |
#tot_golf_pass_rounds ⇒ Object
Returns the value of attribute tot_golf_pass_rounds.
6 7 8 |
# File 'lib/golf_switch/golf_book.rb', line 6 def tot_golf_pass_rounds @tot_golf_pass_rounds end |
#tot_greens_fee ⇒ Object
Returns the value of attribute tot_greens_fee.
5 6 7 |
# File 'lib/golf_switch/golf_book.rb', line 5 def tot_greens_fee @tot_greens_fee end |
#tot_non_refundable ⇒ Object
Returns the value of attribute tot_non_refundable.
6 7 8 |
# File 'lib/golf_switch/golf_book.rb', line 6 def tot_non_refundable @tot_non_refundable end |
#tot_trans_fee ⇒ Object
Returns the value of attribute tot_trans_fee.
5 6 7 |
# File 'lib/golf_switch/golf_book.rb', line 5 def tot_trans_fee @tot_trans_fee end |
#tot_voucher_charged ⇒ Object
Returns the value of attribute tot_voucher_charged.
6 7 8 |
# File 'lib/golf_switch/golf_book.rb', line 6 def tot_voucher_charged @tot_voucher_charged end |
Class Method Details
.parse_golf_books(response) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/golf_switch/golf_book.rb', line 23 def self.parse_golf_books(response) golf_books = [] if response[:golf_books] && response[:golf_books][:golf_book].is_a?(Array) response[:golf_books][:golf_book].each do |golf_book| golf_books << GolfSwitch::GolfBook.new(response[:golf_books][:golf_book]) end elsif response[:golf_books] && response[:golf_books][:golf_book].is_a?(Hash) golf_books << GolfSwitch::GolfBook.new(response[:golf_books][:golf_book]) end golf_books end |
Instance Method Details
#to_hash ⇒ Object
35 36 37 38 39 |
# File 'lib/golf_switch/golf_book.rb', line 35 def to_hash hash = {} instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) } hash end |