Class: Lce::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Errors, Request
Defined in:
lib/lce/client.rb,
lib/lce/client/errors.rb,
lib/lce/client/request.rb,
lib/lce/client/connection.rb

Defined Under Namespace

Modules: Connection, Errors, Request

Constant Summary collapse

HOSTS =
{
  development: "http://localhost:9000",
  staging: "https://test.myflyingbox.com",
  production: "https://api.myflyingbox.com"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

#get, #post

Constructor Details

#initializeClient

Returns a new instance of Client.



20
21
22
# File 'lib/lce/client.rb', line 20

def initialize
  @http_adapter = Lce.configuration.http_adapter
end

Instance Attribute Details

#http_adapterObject

Returns the value of attribute http_adapter.



18
19
20
# File 'lib/lce/client.rb', line 18

def http_adapter
  @http_adapter
end

Instance Method Details

#api_versionObject

Raises:



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

def api_version
  raise VersionError.new("Wrong API version",' wrong_api_version', "Version must be 1 or 2.") unless [1, 2].include?(Lce.configuration.api_version)
  'v'+Lce.configuration.api_version.to_s
end

#hostObject



24
25
26
# File 'lib/lce/client.rb', line 24

def host
  HOSTS[Lce.configuration.environment]
end