Sha256: ddc5a47d1872c67bc5a03eeb303eb5ce58832f820ae050931c13601c41427973

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

require 'httparty'
require 'oga'

module Tessitura
  class PriceType < Struct.new(:xml_data)
    include AttrAccessorOfType

    attr_accessor :doc

    attr_accessor_of_type :category, type: String
    attr_accessor_of_type :def_price_type, type: TrueClass
    attr_accessor_of_type :description, type: String
    attr_accessor_of_type :price_type, type: Integer
    attr_accessor_of_type :promo, type: TrueClass
    attr_accessor_of_type :promo_max, type: Integer
    attr_accessor_of_type :promo_override_default, type: TrueClass
    attr_accessor_of_type :promo_rank, type: Integer
    attr_accessor_of_type :short_desc, type: String

    def initialize(xml_data)
      super(xml_data)
      self.doc = Oga.parse_xml(xml_data)
    end

    def id
      return unless att = doc.at_xpath('//PriceType').attribute('diffgr:id')
      att.value
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tessitura-0.1.0 lib/tessitura/price_type.rb