Class: Io::Flow::V0::Models::Region

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

A region represents a geographic area of the world. Regions can be countries, continents or other political areas (like the Eurozone). See https://api.flow.io/reference/regions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Region

Returns a new instance of Region.



44801
44802
44803
44804
44805
44806
44807
44808
44809
44810
44811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44801

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :countries, :currencies, :languages, :measurement_systems, :timezones], 'Region')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @countries = HttpClient::Preconditions.assert_class('countries', opts.delete(:countries), Array).map { |v| HttpClient::Preconditions.assert_class('countries', v, String) }
  @currencies = HttpClient::Preconditions.assert_class('currencies', opts.delete(:currencies), Array).map { |v| HttpClient::Preconditions.assert_class('currencies', v, String) }
  @languages = HttpClient::Preconditions.assert_class('languages', opts.delete(:languages), Array).map { |v| HttpClient::Preconditions.assert_class('languages', v, String) }
  @measurement_systems = HttpClient::Preconditions.assert_class('measurement_systems', opts.delete(:measurement_systems), Array).map { |v| HttpClient::Preconditions.assert_class('measurement_systems', v, String) }
  @timezones = HttpClient::Preconditions.assert_class('timezones', opts.delete(:timezones), Array).map { |v| HttpClient::Preconditions.assert_class('timezones', v, String) }
end

Instance Attribute Details

#countriesObject (readonly)

Returns the value of attribute countries.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def countries
  @countries
end

#currenciesObject (readonly)

Returns the value of attribute currencies.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def currencies
  @currencies
end

#idObject (readonly)

Returns the value of attribute id.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def id
  @id
end

#languagesObject (readonly)

Returns the value of attribute languages.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def languages
  @languages
end

#measurement_systemsObject (readonly)

Returns the value of attribute measurement_systems.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def measurement_systems
  @measurement_systems
end

#nameObject (readonly)

Returns the value of attribute name.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def name
  @name
end

#timezonesObject (readonly)

Returns the value of attribute timezones.



44799
44800
44801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44799

def timezones
  @timezones
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44817
44818
44819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44817

def copy(incoming={})
  Region.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



44821
44822
44823
44824
44825
44826
44827
44828
44829
44830
44831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44821

def to_hash
  {
    :id => id,
    :name => name,
    :countries => countries,
    :currencies => currencies,
    :languages => languages,
    :measurement_systems => measurement_systems,
    :timezones => timezones
  }
end

#to_jsonObject



44813
44814
44815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44813

def to_json
  JSON.dump(to_hash)
end