Class: Magento::PolymorphicModel

Inherits:
Object
  • Object
show all
Defined in:
lib/magento/polymorphic_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, api_resource) ⇒ PolymorphicModel

Returns a new instance of PolymorphicModel.



5
6
7
8
# File 'lib/magento/polymorphic_model.rb', line 5

def initialize(model, api_resource)
  @model = model
  @api_resource = api_resource
end

Instance Attribute Details

#api_resourceObject (readonly)

Returns the value of attribute api_resource.



3
4
5
# File 'lib/magento/polymorphic_model.rb', line 3

def api_resource
  @api_resource
end

Instance Method Details

#build(attributes) ⇒ Object



14
15
16
# File 'lib/magento/polymorphic_model.rb', line 14

def build(attributes)
  @model.build(attributes)
end

#newObject



10
11
12
# File 'lib/magento/polymorphic_model.rb', line 10

def new
  @model.new
end