Module: YandexDelivery

Defined in:
lib/yandex-delivery.rb,
lib/yandex-delivery/request.rb,
lib/yandex-delivery/version.rb,
lib/yandex-delivery/response.rb,
lib/yandex-delivery/api_request.rb,
lib/yandex-delivery/yandex_error.rb,
lib/yandex-delivery/yandex_delivery_error.rb,
lib/generators/yandex_delivery/install/install_generator.rb

Defined Under Namespace

Classes: APIRequest, DynamicSetting, InstallGenerator, Request, Response, YandexDeliveryError, YandexError

Constant Summary collapse

VERSION =
"0.0.11"

Class Method Summary collapse

Class Method Details

.add_reader(name) ⇒ Object



23
24
25
26
27
# File 'lib/yandex-delivery.rb', line 23

def add_reader(name)
  define_singleton_method(name) do |*args|
    send("#{name}_setting").value(*args)
  end
end

.add_writer(name, type) ⇒ Object



29
30
31
32
33
# File 'lib/yandex-delivery.rb', line 29

def add_writer(name, type)
  define_singleton_method("#{name}=") do |value|
    send("#{name}_setting=", DynamicSetting.build(value, type))
  end
end

.register(name, value, type = nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/yandex-delivery.rb', line 15

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| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



11
12
13
# File 'lib/yandex-delivery.rb', line 11

def setup
  yield self
end