Class: GolfSwitch::Player
- Inherits:
-
Object
- Object
- GolfSwitch::Player
- Defined in:
- lib/golf_switch/player.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#handicap ⇒ Object
Returns the value of attribute handicap.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#member_no ⇒ Object
Returns the value of attribute member_no.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#profile_id ⇒ Object
Returns the value of attribute profile_id.
-
#rewards_id ⇒ Object
Returns the value of attribute rewards_id.
-
#rewards_pgm_id ⇒ Object
Returns the value of attribute rewards_pgm_id.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Player
constructor
A new instance of Player.
- #option_attributes ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 11 12 13 14 |
# File 'lib/golf_switch/player.rb', line 6 def initialize(attributes={}) attributes.each do |name, value| begin send("#{name}=", value) rescue puts "invalid attribute #{name} in player" end end end |
Instance Attribute Details
#address1 ⇒ Object
Returns the value of attribute address1.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def address1 @address1 end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def first_name @first_name end |
#handicap ⇒ Object
Returns the value of attribute handicap.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def handicap @handicap end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def last_name @last_name end |
#member_no ⇒ Object
Returns the value of attribute member_no.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def member_no @member_no end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def phone @phone end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def postal_code @postal_code end |
#profile_id ⇒ Object
Returns the value of attribute profile_id.
3 4 5 |
# File 'lib/golf_switch/player.rb', line 3 def profile_id @profile_id end |
#rewards_id ⇒ Object
Returns the value of attribute rewards_id.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def rewards_id @rewards_id end |
#rewards_pgm_id ⇒ Object
Returns the value of attribute rewards_pgm_id.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def rewards_pgm_id @rewards_pgm_id end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/golf_switch/player.rb', line 4 def state @state end |
Instance Method Details
#option_attributes ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/golf_switch/player.rb', line 16 def option_attributes = {} .merge!("ProfileId"=>@profile_id) unless @profile_id.blank? .merge!("FirstName"=>@first_name) .merge!("LastName"=>@last_name) .merge!("Email"=>@email) .merge!("Phone"=>@phone) .merge!("Address1"=>@address1) unless @address1.blank? .merge!("City"=>@city) .merge!("State"=>@state) .merge!("Country"=>@country || "USA") .merge!("PostalCode"=>@postal_code) .merge!("MemberNo"=>@member_no) unless @member_no.blank? .merge!("Handicap"=>@handicap) unless @handicap.blank? && @handicap!="Handicap" .merge!("RewardsPgmId"=>@rewards_pgm_id) unless @rewards_pgm_id.blank? .merge!("RewardsId"=>@rewards_id) unless @rewards_id.blank? end |