Class: Io::Flow::V0::Clients::Locales
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Locales
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(incoming = {}) ⇒ Object
Returns a list of locales.
-
#get_by_id(id) ⇒ Object
Returns the locale with the specifed id.
-
#initialize(client) ⇒ Locales
constructor
A new instance of Locales.
Constructor Details
#initialize(client) ⇒ Locales
Returns a new instance of Locales.
5001 5002 5003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5001 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(incoming = {}) ⇒ Object
Returns a list of locales.
5006 5007 5008 5009 5010 5011 5012 5013 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5006 def get(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/reference/locales").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Locale.new(x) } end |
#get_by_id(id) ⇒ Object
Returns the locale with the specifed id.
5016 5017 5018 5019 5020 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5016 def get_by_id(id) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/reference/locales/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::Locale.new(r) end |