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.
25064 25065 25066 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25064 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
25062 25063 25064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25062 def value @value end |
Class Method Details
.ALL ⇒ Object
25084 25085 25086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25084 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
25069 25070 25071 25072 25073 25074 25075 25076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25069 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
25088 25089 25090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25088 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
25079 25080 25081 25082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25079 def PostalType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) PostalType.ALL.find { |v| v.value == value } end |
.pin ⇒ Object
25092 25093 25094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25092 def PostalType.pin @@_pin ||= PostalType.new('pin') end |
.postal ⇒ Object
25096 25097 25098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25096 def PostalType.postal @@_postal ||= PostalType.new('postal') end |
.zip ⇒ Object
25100 25101 25102 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25100 def PostalType.zip @@_zip ||= PostalType.new('zip') end |
Instance Method Details
#to_hash ⇒ Object
25104 25105 25106 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25104 def to_hash value end |