Module: Forward::Api

Defined in:
lib/forward/api.rb,
lib/forward/api/user.rb,
lib/forward/api/tunnel.rb,
lib/forward/api/resource.rb,
lib/forward/api/client_log.rb,
lib/forward/api/tunnel_key.rb

Defined Under Namespace

Classes: BadResponse, ClientLog, Resource, ResourceError, ResourceNotFound, Tunnel, TunnelKey, User

Constant Summary collapse

DEFAULT_API_HOST =
'https://forwardhq.com'

Class Method Summary collapse

Class Method Details

.ssl?Boolean

Returns True or False if we should be using ssl

Returns a Boolean.

Returns:

  • (Boolean)


36
37
38
# File 'lib/forward/api.rb', line 36

def self.ssl?
  uri.scheme == 'https'
end

.tokenObject



44
45
46
# File 'lib/forward/api.rb', line 44

def self.token
  defined?(@api_token) ? @api_token : nil
end

.token=(token) ⇒ Object



40
41
42
# File 'lib/forward/api.rb', line 40

def self.token=(token)
  @api_token = token
end

.uriObject

Returns either an api host set in the environment or a set default.

Returns a String containing the api host.



29
30
31
# File 'lib/forward/api.rb', line 29

def self.uri
  URI.parse(ENV['FORWARD_API_HOST'] || DEFAULT_API_HOST)
end