Module: DaazwebApi

Defined in:
lib/daazweb-api.rb,
lib/daazweb-api/request.rb,
lib/daazweb-api/version.rb,
lib/daazweb-api/response.rb,
lib/daazweb-api/api_request.rb,
lib/daazweb-api/daazweb_api_error.rb,
lib/generators/daazweb-api/install/install_generator.rb

Defined Under Namespace

Classes: APIRequest, DaazwebApiError, DynamicSetting, InstallGenerator, Request, Response

Constant Summary collapse

API_ENDPOINT =
"https://bitconce.com"
VERSION =
"0.0.9"

Class Method Summary collapse

Class Method Details

.add_reader(name) ⇒ Object



26
27
28
29
30
# File 'lib/daazweb-api.rb', line 26

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

.add_writer(name, type) ⇒ Object



32
33
34
35
36
# File 'lib/daazweb-api.rb', line 32

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



18
19
20
21
22
23
24
# File 'lib/daazweb-api.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| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (DaazwebApi)

    the object that the method was called on



14
15
16
# File 'lib/daazweb-api.rb', line 14

def setup
  yield self
end