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

Defined Under Namespace

Classes: JsonParseError, NotAuthorizedAccessError, TimeoutError

Class Method Summary collapse

Class Method Details

.domainObject



43
44
45
46
# File 'lib/wrappi/client.rb', line 43

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

.domain=(domain) ⇒ Object



29
30
31
# File 'lib/wrappi/client.rb', line 29

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

.errorsObject



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

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

.rootObject



56
57
58
# File 'lib/wrappi/client.rb', line 56

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

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

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/wrappi/client.rb', line 25

def self.setup
  yield(self)
end

.timeoutObject



37
38
39
40
41
# File 'lib/wrappi/client.rb', line 37

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

.timeout=(opts) ⇒ Object



33
34
35
# File 'lib/wrappi/client.rb', line 33

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