Class: Workarea::GlobalE::Attribute

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/global_e/attribute.rb

Instance Method Summary collapse

Constructor Details

#initialize(code: nil, name: nil, type_code: nil) ⇒ Attribute

Returns a new instance of Attribute.



5
6
7
8
9
# File 'app/services/workarea/global_e/attribute.rb', line 5

def initialize(code: nil, name: nil, type_code: nil)
  @code = code
  @name = name
  @type_code = type_code
end

Instance Method Details

#as_json(*_args) ⇒ Object



11
12
13
14
15
16
17
# File 'app/services/workarea/global_e/attribute.rb', line 11

def as_json(*_args)
  {
    AttributeCode: attribute_code,
    Name: name,
    AttributeTypeCode: attribute_type_code
  }.compact
end

#attribute_codeString

Custom attribute code denoting a Merchant-specific attribute such as Size, Color, etc. (to be mapped on Global-e side)

Returns:

  • (String)


24
25
26
# File 'app/services/workarea/global_e/attribute.rb', line 24

def attribute_code
  @code
end

#attribute_type_codeObject

Code used to identify the attribute type on the Merchant’s site such as “size” for Size, “color” for Color, etc. (to be mapped on Global-e side)



39
40
41
# File 'app/services/workarea/global_e/attribute.rb', line 39

def attribute_type_code
  @type_code
end

#nameString

Attribute name

Returns:

  • (String)


32
33
34
# File 'app/services/workarea/global_e/attribute.rb', line 32

def name
  @name
end