Class: Io::Flow::V0::Models::Country
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Country
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
ISO 3166 country codes. Note Flow APIs will accept either the 2 or 3 character country code, but internally we normalize data and store as the 3 character, upper case ISO code. See https://api.flow.io/reference/countries
Instance Attribute Summary collapse
-
#default_currency ⇒ Object
readonly
Returns the value of attribute default_currency.
-
#default_delivered_duty ⇒ Object
readonly
Returns the value of attribute default_delivered_duty.
-
#default_language ⇒ Object
readonly
Returns the value of attribute default_language.
-
#iso_3166_2 ⇒ Object
readonly
Returns the value of attribute iso_3166_2.
-
#iso_3166_3 ⇒ Object
readonly
Returns the value of attribute iso_3166_3.
-
#languages ⇒ Object
readonly
Returns the value of attribute languages.
-
#measurement_system ⇒ Object
readonly
Returns the value of attribute measurement_system.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timezones ⇒ Object
readonly
Returns the value of attribute timezones.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Country
constructor
A new instance of Country.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Country
Returns a new instance of Country.
25878 25879 25880 25881 25882 25883 25884 25885 25886 25887 25888 25889 25890 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25878 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :iso_3166_2, :iso_3166_3, :languages, :measurement_system, :timezones], 'Country') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @iso_3166_2 = HttpClient::Preconditions.assert_class('iso_3166_2', opts.delete(:iso_3166_2), String) @iso_3166_3 = HttpClient::Preconditions.assert_class('iso_3166_3', opts.delete(:iso_3166_3), String) @languages = HttpClient::Preconditions.assert_class('languages', opts.delete(:languages), Array).map { |v| HttpClient::Preconditions.assert_class('languages', v, String) } @measurement_system = HttpClient::Preconditions.assert_class('measurement_system', opts.delete(:measurement_system), String) @default_currency = (x = opts.delete(:default_currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('default_currency', x, String)) @default_language = (x = opts.delete(:default_language); x.nil? ? nil : HttpClient::Preconditions.assert_class('default_language', x, String)) @timezones = HttpClient::Preconditions.assert_class('timezones', opts.delete(:timezones), Array).map { |v| HttpClient::Preconditions.assert_class('timezones', v, String) } @default_delivered_duty = (x = opts.delete(:default_delivered_duty); x.nil? ? nil : HttpClient::Preconditions.assert_class('default_delivered_duty', x, String)) end |
Instance Attribute Details
#default_currency ⇒ Object (readonly)
Returns the value of attribute default_currency.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def default_currency @default_currency end |
#default_delivered_duty ⇒ Object (readonly)
Returns the value of attribute default_delivered_duty.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def default_delivered_duty @default_delivered_duty end |
#default_language ⇒ Object (readonly)
Returns the value of attribute default_language.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def default_language @default_language end |
#iso_3166_2 ⇒ Object (readonly)
Returns the value of attribute iso_3166_2.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def iso_3166_2 @iso_3166_2 end |
#iso_3166_3 ⇒ Object (readonly)
Returns the value of attribute iso_3166_3.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def iso_3166_3 @iso_3166_3 end |
#languages ⇒ Object (readonly)
Returns the value of attribute languages.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def languages @languages end |
#measurement_system ⇒ Object (readonly)
Returns the value of attribute measurement_system.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def measurement_system @measurement_system end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def name @name end |
#timezones ⇒ Object (readonly)
Returns the value of attribute timezones.
25876 25877 25878 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25876 def timezones @timezones end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25896 25897 25898 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25896 def copy(incoming={}) Country.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25900 25901 25902 25903 25904 25905 25906 25907 25908 25909 25910 25911 25912 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25900 def to_hash { :name => name, :iso_3166_2 => iso_3166_2, :iso_3166_3 => iso_3166_3, :languages => languages, :measurement_system => measurement_system, :default_currency => default_currency, :default_language => default_language, :timezones => timezones, :default_delivered_duty => default_delivered_duty } end |
#to_json ⇒ Object
25892 25893 25894 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25892 def to_json JSON.dump(to_hash) end |