Class: Io::Flow::V0::Models::PostalType
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PostalType
- 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 PostalType for this value, creating a new instance for an unknown value.
- .eircode ⇒ Object
-
.from_string(value) ⇒ Object
Returns the instance of PostalType for this value, or nil if not found.
- .pin ⇒ Object
- .postal ⇒ Object
- .zip ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ PostalType
constructor
A new instance of PostalType.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ PostalType
Returns a new instance of PostalType.
23019 23020 23021 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23019 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
23017 23018 23019 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23017 def value @value end |
Class Method Details
.ALL ⇒ Object
23039 23040 23041 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23039 def PostalType.ALL @@all ||= [PostalType.eircode, PostalType.pin, PostalType.postal, PostalType.zip] end |
.apply(value) ⇒ Object
Returns the instance of PostalType for this value, creating a new instance for an unknown value
23024 23025 23026 23027 23028 23029 23030 23031 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23024 def PostalType.apply(value) if value.instance_of?(PostalType) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || PostalType.new(value)) end end |
.eircode ⇒ Object
23043 23044 23045 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23043 def PostalType.eircode @@_eircode ||= PostalType.new('eircode') end |
.from_string(value) ⇒ Object
Returns the instance of PostalType for this value, or nil if not found
23034 23035 23036 23037 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23034 def PostalType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) PostalType.ALL.find { |v| v.value == value } end |
.pin ⇒ Object
23047 23048 23049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23047 def PostalType.pin @@_pin ||= PostalType.new('pin') end |
.postal ⇒ Object
23051 23052 23053 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23051 def PostalType.postal @@_postal ||= PostalType.new('postal') end |
.zip ⇒ Object
23055 23056 23057 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23055 def PostalType.zip @@_zip ||= PostalType.new('zip') end |
Instance Method Details
#to_hash ⇒ Object
23059 23060 23061 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23059 def to_hash value end |