Class: Io::Flow::V0::Models::ItemIdentifier
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemIdentifier
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of ItemIdentifier for this value, creating a new instance for an unknown value.
-
.from_string(value) ⇒ Object
Returns the instance of ItemIdentifier for this value, or nil if not found.
- .item_number ⇒ Object
- .sku ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ ItemIdentifier
constructor
A new instance of ItemIdentifier.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ ItemIdentifier
Returns a new instance of ItemIdentifier.
17384 17385 17386 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17384 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
17382 17383 17384 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17382 def value @value end |
Class Method Details
.ALL ⇒ Object
17404 17405 17406 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17404 def ItemIdentifier.ALL @@all ||= [ItemIdentifier.item_number, ItemIdentifier.sku] end |
.apply(value) ⇒ Object
Returns the instance of ItemIdentifier for this value, creating a new instance for an unknown value
17389 17390 17391 17392 17393 17394 17395 17396 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17389 def ItemIdentifier.apply(value) if value.instance_of?(ItemIdentifier) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || ItemIdentifier.new(value)) end end |
.from_string(value) ⇒ Object
Returns the instance of ItemIdentifier for this value, or nil if not found
17399 17400 17401 17402 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17399 def ItemIdentifier.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) ItemIdentifier.ALL.find { |v| v.value == value } end |
.item_number ⇒ Object
17408 17409 17410 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17408 def ItemIdentifier.item_number @@_item_number ||= ItemIdentifier.new('item_number') end |
.sku ⇒ Object
17412 17413 17414 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17412 def ItemIdentifier.sku @@_sku ||= ItemIdentifier.new('sku') end |
Instance Method Details
#to_hash ⇒ Object
17416 17417 17418 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17416 def to_hash value end |