module OzonLogistics

Constants

VERSION

Public Class Methods

add_reader(name) click to toggle source
# File lib/ozon-logistics.rb, line 26
def add_reader(name)
  define_singleton_method(name) do |*args|
    send("#{name}_setting").value(*args)
  end
end
add_writer(name, type) click to toggle source
# File lib/ozon-logistics.rb, line 32
def add_writer(name, type)
  define_singleton_method("#{name}=") do |value|
    send("#{name}_setting=", DynamicSetting.build(value, type))
  end
end
generate_access_token(client_id=OzonLogistics.client_id, client_secret=OzonLogistics.client_secret, grant_type=OzonLogistics.grant_type) click to toggle source
# File lib/ozon-logistics.rb, line 9
def generate_access_token(client_id=OzonLogistics.client_id, client_secret=OzonLogistics.client_secret, grant_type=OzonLogistics.grant_type)
  response = Faraday.post(OzonLogistics.url_token, "grant_type=#{grant_type}&client_id=#{client_id}&client_secret=#{client_secret}")
  JSON.parse(response.body)
end
register(name, value, type = nil) click to toggle source
# File lib/ozon-logistics.rb, line 18
def register(name, value, type = nil)
  cattr_accessor "#{name}_setting".to_sym

  add_reader(name)
  add_writer(name, type)
  send "#{name}=", value
end
setup() { |self| ... } click to toggle source
# File lib/ozon-logistics.rb, line 14
def setup
  yield self
end