Module: LocoRb::Api::Locale
- Included in:
- Client
- Defined in:
- lib/loco-rb/api/locale.rb
Constant Summary collapse
- PATH =
'locales'- CREATE_PARAMS =
i[code].freeze
Instance Method Summary collapse
Instance Method Details
#create_locale(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/loco-rb/api/locale.rb', line 7 def create_locale(={}) opts = {} .each do |key, value| if CREATE_PARAMS.include?(key) opts[:body] = {} unless opts.key?(:body) opts[:body][key] = value end end response = post(PATH, opts) LocoRb::Resource::Locale.new(response.data, response.headers, 'locale') end |
#get_locale(options = {code: 'en'}) ⇒ Object
19 20 21 22 |
# File 'lib/loco-rb/api/locale.rb', line 19 def get_locale(={code: 'en'}) response = get("#{PATH}/#{options[:code]}") LocoRb::Resource::Locale.new(response.data, response.headers, 'locale') end |