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.
21882 21883 21884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21882 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
21880 21881 21882 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21880 def value @value end |
Class Method Details
.ALL ⇒ Object
21902 21903 21904 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21902 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
21887 21888 21889 21890 21891 21892 21893 21894 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21887 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
21906 21907 21908 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21906 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
21897 21898 21899 21900 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21897 def PostalType.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) PostalType.ALL.find { |v| v.value == value } end |
.pin ⇒ Object
21910 21911 21912 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21910 def PostalType.pin @@_pin ||= PostalType.new('pin') end |
.postal ⇒ Object
21914 21915 21916 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21914 def PostalType.postal @@_postal ||= PostalType.new('postal') end |
.zip ⇒ Object
21918 21919 21920 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21918 def PostalType.zip @@_zip ||= PostalType.new('zip') end |
Instance Method Details
#to_hash ⇒ Object
21922 21923 21924 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21922 def to_hash value end |