Class: BadASS::Toy
- Inherits:
-
Object
- Object
- BadASS::Toy
- Defined in:
- lib/badass/toy.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
-
#flop_reason ⇒ Object
readonly
Returns the value of attribute flop_reason.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #cumtube? ⇒ Boolean
-
#initialize(toy_hash) ⇒ Toy
constructor
Create a Toy object using a hash from the API.
- #name ⇒ Object
- #suction_cup? ⇒ Boolean
Constructor Details
#initialize(toy_hash) ⇒ Toy
Create a Toy object using a hash from the API.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/badass/toy.rb', line 3 def initialize(toy_hash) @id = toy_hash['id'] @sku = toy_hash['sku'] @size = toy_hash['size'] @price = toy_hash['price'] @weight = toy_hash['weight'] @color = toy_hash['color'] @colors = [toy_hash['color1'], toy_hash['color2'], toy_hash['color3']] @flop_reason = toy_hash['flop_reason'].capitalize @type = toy_hash['type'].capitalize @cumtube = toy_hash['cumtube'] @suction_cup = toy_hash['suction_cup'] @images = toy_hash['images'].map { |toy| toy['fullFilename'] } end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
35 36 37 |
# File 'lib/badass/toy.rb', line 35 def color @color end |
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
36 37 38 |
# File 'lib/badass/toy.rb', line 36 def colors @colors end |
#flop_reason ⇒ Object (readonly)
Returns the value of attribute flop_reason.
37 38 39 |
# File 'lib/badass/toy.rb', line 37 def flop_reason @flop_reason end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
30 31 32 |
# File 'lib/badass/toy.rb', line 30 def id @id end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
39 40 41 |
# File 'lib/badass/toy.rb', line 39 def images @images end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
33 34 35 |
# File 'lib/badass/toy.rb', line 33 def price @price end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
32 33 34 |
# File 'lib/badass/toy.rb', line 32 def size @size end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
31 32 33 |
# File 'lib/badass/toy.rb', line 31 def sku @sku end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
38 39 40 |
# File 'lib/badass/toy.rb', line 38 def type @type end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
34 35 36 |
# File 'lib/badass/toy.rb', line 34 def weight @weight end |
Instance Method Details
#cumtube? ⇒ Boolean
22 23 24 |
# File 'lib/badass/toy.rb', line 22 def cumtube? @cumtube == 1 end |
#name ⇒ Object
18 19 20 |
# File 'lib/badass/toy.rb', line 18 def name BadASS::BAD_DRAGON_SKUS[sku] end |
#suction_cup? ⇒ Boolean
26 27 28 |
# File 'lib/badass/toy.rb', line 26 def suction_cup? @suction_cup == 1 end |