Class: FronkinBandcamp::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/fronkin_bandcamp/format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



13
14
15
# File 'lib/fronkin_bandcamp/format.rb', line 13

def description
  @description
end

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

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/fronkin_bandcamp/format.rb', line 13

def name
  @name
end

#priceObject (readonly)

Returns the value of attribute price.



13
14
15
# File 'lib/fronkin_bandcamp/format.rb', line 13

def price
  @price
end

#productObject (readonly)

Returns the value of attribute product.



13
14
15
# File 'lib/fronkin_bandcamp/format.rb', line 13

def product
  @product
end

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