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.
17123 17124 17125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17123 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
17121 17122 17123 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17121 def value @value end |
Class Method Details
.ALL ⇒ Object
17143 17144 17145 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17143 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
17128 17129 17130 17131 17132 17133 17134 17135 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17128 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
17138 17139 17140 17141 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17138 def ItemIdentifier.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) ItemIdentifier.ALL.find { |v| v.value == value } end |
.item_number ⇒ Object
17147 17148 17149 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17147 def ItemIdentifier.item_number @@_item_number ||= ItemIdentifier.new('item_number') end |
.sku ⇒ Object
17151 17152 17153 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17151 def ItemIdentifier.sku @@_sku ||= ItemIdentifier.new('sku') end |
Instance Method Details
#to_hash ⇒ Object
17155 17156 17157 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17155 def to_hash value end |