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.
21778 21779 21780 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21778 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
21776 21777 21778 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21776 def value @value end |
Class Method Details
.ALL ⇒ Object
21798 21799 21800 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21798 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
21783 21784 21785 21786 21787 21788 21789 21790 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21783 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
21793 21794 21795 21796 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21793 def ItemIdentifier.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) ItemIdentifier.ALL.find { |v| v.value == value } end |
.item_number ⇒ Object
21802 21803 21804 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21802 def ItemIdentifier.item_number @@_item_number ||= ItemIdentifier.new('item_number') end |
.sku ⇒ Object
21806 21807 21808 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21806 def ItemIdentifier.sku @@_sku ||= ItemIdentifier.new('sku') end |
Instance Method Details
#to_hash ⇒ Object
21810 21811 21812 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21810 def to_hash value end |