ePages-de/epages-rest-ruby

View on GitHub
lib/epages/variation_attribute.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'epages/utils'

module Epages
  class VariationAttribute
    include Epages::Utils

    attr_accessor :name, :display_name, :values

    def initialize(data)
      parse_attributes(data)
    end

    # returns an array with all the values
    def formatted_values
      values.collect { |el| el[:value] }
    end

    # returns an array with all the display_values
    def display_values
      values.collect { |el| el[:displayValue] }
    end
  end
end