Module: SimpleSDKBuilder::Base

Defined in:
lib/simple_sdk_builder/base.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_TIMEOUT_MILLISECONDS =
15000

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/simple_sdk_builder/base.rb', line 11

def self.included(klass)
  klass.class_eval do
    include SimplyConfigurable
  end

  klass.extend ClassMethods

  klass.config :service_url => "http://localhost:3000/v1"
  klass.config :timeout => DEFAULT_TIMEOUT_MILLISECONDS
  klass.config :error_handlers => {
    nil => ConnectionError,
    '404' => NotFoundError,
    '422' => RequestError,
    '*' => UnknownError
  }
  klass.config :logger => default_logger
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
# File 'lib/simple_sdk_builder/base.rb', line 29

def ==(other)
  self.equal?(other) || (self.id && self.id == other.id && self.class == other.class)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/simple_sdk_builder/base.rb', line 33

def eql?(other)
  self == other
end

#json_request(options = {}) ⇒ Object



37
38
39
# File 'lib/simple_sdk_builder/base.rb', line 37

def json_request(options = {})
  self.class.json_request(options)
end

#loggerObject



41
42
43
# File 'lib/simple_sdk_builder/base.rb', line 41

def logger
  self.class.logger
end