Class: BadASS::Toy

Inherits:
Object
  • Object
show all
Defined in:
lib/badass/toy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject (readonly)

Returns the value of attribute color.



35
36
37
# File 'lib/badass/toy.rb', line 35

def color
  @color
end

#colorsObject (readonly)

Returns the value of attribute colors.



36
37
38
# File 'lib/badass/toy.rb', line 36

def colors
  @colors
end

#flop_reasonObject (readonly)

Returns the value of attribute flop_reason.



37
38
39
# File 'lib/badass/toy.rb', line 37

def flop_reason
  @flop_reason
end

#idObject (readonly)

Returns the value of attribute id.



30
31
32
# File 'lib/badass/toy.rb', line 30

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



39
40
41
# File 'lib/badass/toy.rb', line 39

def images
  @images
end

#priceObject (readonly)

Returns the value of attribute price.



33
34
35
# File 'lib/badass/toy.rb', line 33

def price
  @price
end

#sizeObject (readonly)

Returns the value of attribute size.



32
33
34
# File 'lib/badass/toy.rb', line 32

def size
  @size
end

#skuObject (readonly)

Returns the value of attribute sku.



31
32
33
# File 'lib/badass/toy.rb', line 31

def sku
  @sku
end

#typeObject (readonly)

Returns the value of attribute type.



38
39
40
# File 'lib/badass/toy.rb', line 38

def type
  @type
end

#weightObject (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

Returns:

  • (Boolean)


22
23
24
# File 'lib/badass/toy.rb', line 22

def cumtube?
  @cumtube == 1
end

#nameObject



18
19
20
# File 'lib/badass/toy.rb', line 18

def name
  BadASS::BAD_DRAGON_SKUS[sku]
end

#suction_cup?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/badass/toy.rb', line 26

def suction_cup?
  @suction_cup == 1
end