Class: FronkinBandcamp::Format
- Inherits:
-
Object
- Object
- FronkinBandcamp::Format
- Defined in:
- lib/fronkin_bandcamp/format.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#is_available ⇒ Object
readonly
Returns the value of attribute is_available.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#product ⇒ Object
readonly
Returns the value of attribute product.
-
#product_images ⇒ Object
readonly
Returns the value of attribute product_images.
Instance Method Summary collapse
-
#initialize(choice) ⇒ Format
constructor
A new instance of Format.
Constructor Details
#initialize(choice) ⇒ Format
Returns a new instance of Format.
15 16 17 18 19 20 21 22 |
# File 'lib/fronkin_bandcamp/format.rb', line 15 def initialize(choice) @name = choice.css('h3.hd span').text.kleanse || 'Subcription' @product = choice.css('h3.hd div.secondaryText').text.strip @description = choice.css('div.bd').text.kleanse @product_images = choice.css('a.popupImage').map { |anchor| anchor.attribute('href').value } @price = choice.css('div.ft h4.main-button').text.kleanse || choice.css('h4.ft.compound-button').text.kleanse @is_available = choice.css('div.ft h4.notable').text.strip != 'Sold Out' ? true : false end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def description @description end |
#is_available ⇒ Object (readonly)
Returns the value of attribute is_available.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def is_available @is_available end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def price @price end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def product @product end |
#product_images ⇒ Object (readonly)
Returns the value of attribute product_images.
13 14 15 |
# File 'lib/fronkin_bandcamp/format.rb', line 13 def product_images @product_images end |