class Epages::Variation

Attributes

attribute_selection[R]

Public Class Methods

new(data) click to toggle source
# File lib/epages/variation.rb, line 9
def initialize(data)
  parse_attributes(data)
end

Public Instance Methods

attributes()
Alias for: properties
id()
Alias for: product_id
product_id() click to toggle source

returns the product_id of the variation

# File lib/epages/variation.rb, line 19
def product_id
  url.split('/').last
end
Also aliased as: id
properties() click to toggle source

returns a hash formatting the property and the respective value as a pair of the hash

# File lib/epages/variation.rb, line 24
def properties
  Hash[attribute_selection.collect { |el| [el[:name].downcase.to_sym, el[:value]] }]
end
Also aliased as: attributes
url() click to toggle source

returns the url of the variation

# File lib/epages/variation.rb, line 14
def url
  link.href
end