Class: TinyClient::Configuration Abstract

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/tiny_client/configuration.rb

Overview

This class is abstract.

Provides the default client configuration Subclass and override #initialize to implement a client confiuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

You need to initialize the api #url, default #headers, and default limit.

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/tiny_client/configuration.rb', line 12

def initialize
  raise NotImplementedError
end

Instance Attribute Details

#limitInteger (readonly)

default limit used as a query param

Returns:

  • (Integer)

    the current value of limit



7
8
9
# File 'lib/tiny_client/configuration.rb', line 7

def limit
  @limit
end

#urlString (readonly)

the api root url (i.e: localhost/api/1.0)

Returns:

  • (String)

    the current value of url



7
8
9
# File 'lib/tiny_client/configuration.rb', line 7

def url
  @url
end

Instance Method Details

#connect_timeoutInteger

Returns request connection timeout in seconds

Returns:

  • (Integer)

    request connection timeout in seconds



17
18
19
# File 'lib/tiny_client/configuration.rb', line 17

def connect_timeout
  @connect_timeout ||= 30
end

#headersHash

Returns headers default headers you want to pass along every request

Returns:

  • (Hash)

    headers default headers you want to pass along every request



22
23
24
# File 'lib/tiny_client/configuration.rb', line 22

def headers
  @headers ||= {}
end

#requestorObject



32
33
34
# File 'lib/tiny_client/configuration.rb', line 32

def requestor
  @requestor ||= TinyClient::RemoteClient.new(self)
end

#verboseBoolean

Returns true if curl verbose option is set

Returns:

  • (Boolean)

    true if curl verbose option is set



27
28
29
30
# File 'lib/tiny_client/configuration.rb', line 27

def verbose
  @verbose = false if @verbose.nil?
  @verbose
end