Class: Wrappi::Client

Inherits:
Object
  • Object
show all
Includes:
Fusu::Configurable
Defined in:
lib/wrappi/client.rb

Overview

This class is expected to handle all the configurations for your main module

Class Method Summary collapse

Class Method Details

.domainObject



41
42
43
44
# File 'lib/wrappi/client.rb', line 41

def self.domain
  fail "[#{self.class}] Bad configuration: you must set the `domain` config" unless @domain
  @domain
end

.domain=(domain) ⇒ Object



27
28
29
# File 'lib/wrappi/client.rb', line 27

def self.domain=(domain)
  @domain = domain
end

.errorsObject



46
47
48
49
50
51
52
# File 'lib/wrappi/client.rb', line 46

def self.errors
  [
    TimeoutError,
    JsonParseError,
    NotAuthorizedAccessError
  ]
end

.rootObject



54
55
56
# File 'lib/wrappi/client.rb', line 54

def self.root
  Pathname.new(File.expand_path('../../', __FILE__))
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/wrappi/client.rb', line 23

def self.setup
  yield(self)
end

.timeoutObject



35
36
37
38
39
# File 'lib/wrappi/client.rb', line 35

def self.timeout
  return @timeout if defined?(@timeout)
  self.timeout = {}
  @timeout
end

.timeout=(opts) ⇒ Object



31
32
33
# File 'lib/wrappi/client.rb', line 31

def self.timeout=(opts)
  @timeout = { write: 9, connect: 9, read: 9 }.merge(opts)
end