Sha256: e59869d83a55d888d0cfb6f75ef236e2be681679f0c2f3eeadd808d6c26daf17

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

class DiscountType
  attr_accessor :default_discount, :discount_type_id, :name

  # :internal => :external
  def self.attribute_map
  {
      :default_discount => :default_discount, :discount_type_id => :discount_type_id, :name => :name

  }
  end

  def initialize(attributes = {})
    # Morph attribute keys into undescored rubyish style
    if attributes.to_s != ""

      if DiscountType.attribute_map["default_discount".to_sym] != nil
        name = "default_discount".to_sym
        value = attributes["default_discount"]
        send("#{name}=", value) if self.respond_to?(name)
	      end
      if DiscountType.attribute_map["discount_type_id".to_sym] != nil
        name = "discount_type_id".to_sym
        value = attributes["discount_type_id"]
        send("#{name}=", value) if self.respond_to?(name)
	      end
      if DiscountType.attribute_map["name".to_sym] != nil
        name = "name".to_sym
        value = attributes["name"]
        send("#{name}=", value) if self.respond_to?(name)
	      end
      end
  end

  def to_body
    body = {}
    DiscountType.attribute_map.each_pair do |key,value|
      body[value] = self.send(key) unless self.send(key).nil?
    end
    body
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
subtledata-0.0.5 models/discounttype.rb
subtledata-0.0.3 models/discounttype.rb