Class: Bubbles::RestEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/bubbles/rest_environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme = 'https', host = 'api.foamfactory.com', port = 443, api_key = nil) ⇒ RestEnvironment

Construct a new instance of RestEnvironment.

Parameters:

  • scheme (String) (defaults to: 'https')

    The scheme to use for communicating with the host. Currently, http and https are supported.

  • host (String) (defaults to: 'api.foamfactory.com')

    The host to communicate with.

  • port (Integer) (defaults to: 443)

    The port on which the communication channel should operate.

  • api_key (String) (defaults to: nil)

    (Optional) The API key to use to identify your client with the API. Defaults to nil.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bubbles/rest_environment.rb', line 13

def initialize(scheme='https', host='api.foamfactory.com', port=443, api_key=nil)
  @scheme = scheme
  @port = port

  if @scheme == 'http' && @port == 443
    @port = 80
  end

  @host = host
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/bubbles/rest_environment.rb', line 3

def api_key
  @api_key
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/bubbles/rest_environment.rb', line 3

def host
  @host
end

#portObject

Returns the value of attribute port.



3
4
5
# File 'lib/bubbles/rest_environment.rb', line 3

def port
  @port
end

#schemeObject

Returns the value of attribute scheme.



3
4
5
# File 'lib/bubbles/rest_environment.rb', line 3

def scheme
  @scheme
end