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.
20246 20247 20248 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20246 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
20244 20245 20246 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20244 def value @value end |
Class Method Details
.ALL ⇒ Object
20266 20267 20268 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20266 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
20251 20252 20253 20254 20255 20256 20257 20258 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20251 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
20261 20262 20263 20264 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20261 def ItemIdentifier.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) ItemIdentifier.ALL.find { |v| v.value == value } end |
.item_number ⇒ Object
20270 20271 20272 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20270 def ItemIdentifier.item_number @@_item_number ||= ItemIdentifier.new('item_number') end |
.sku ⇒ Object
20274 20275 20276 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20274 def ItemIdentifier.sku @@_sku ||= ItemIdentifier.new('sku') end |
Instance Method Details
#to_hash ⇒ Object
20278 20279 20280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20278 def to_hash value end |