Class: WurflCloud::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/wurfl_cloud/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/wurfl_cloud/configuration.rb', line 52

def initialize
  @api_key                    = "100000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  @api_user                   = 100000
  @api_password               = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  @host                       = 'api.wurflcloud.com'
  @schema                     = 'http'
  @port                       = 80
  @path                       = '/v1/json'
  @api_type                   = 'http'
  @search_parameter           = "search:(%{capabilities})"
  @search_parameter_separator = ','
  @cache_class                = WurflCloud::Cache::Null
  @cache_options              = {}
end

Instance Attribute Details

#api_keyObject

The API key to access the WurflCloud api (defaults to “100000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”).



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

def api_key
  @api_key
end

#api_passwordObject (readonly)

The API password decoded from the api_key



23
24
25
# File 'lib/wurfl_cloud/configuration.rb', line 23

def api_password
  @api_password
end

#api_typeObject

The API Type, defaults to http (*not used*)



38
39
40
# File 'lib/wurfl_cloud/configuration.rb', line 38

def api_type
  @api_type
end

#api_userObject (readonly)

The API user id decoded from the api_key



20
21
22
# File 'lib/wurfl_cloud/configuration.rb', line 20

def api_user
  @api_user
end

#cache_classObject

The cache class to be used (defaults to a WurflCloud::Cache::Null )



47
48
49
# File 'lib/wurfl_cloud/configuration.rb', line 47

def cache_class
  @cache_class
end

#cache_optionsObject

The cache_options to be used (defaults to {})



50
51
52
# File 'lib/wurfl_cloud/configuration.rb', line 50

def cache_options
  @cache_options
end

#hostObject

The host to connect to (defaults to api.wurflcloud.com).



29
30
31
# File 'lib/wurfl_cloud/configuration.rb', line 29

def host
  @host
end

#pathObject

The path (URL) for the API endpoint at the host (defaults to /v1/json).



35
36
37
# File 'lib/wurfl_cloud/configuration.rb', line 35

def path
  @path
end

#portObject

The port on which your WurflCloud server runs (defaults to 80).



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

def port
  @port
end

#schemaObject

The schema of the URI for the api server (defaults to http).



26
27
28
# File 'lib/wurfl_cloud/configuration.rb', line 26

def schema
  @schema
end

#search_parameterObject

The search parameter format (defaults to “search:(%capabilities)”)



41
42
43
# File 'lib/wurfl_cloud/configuration.rb', line 41

def search_parameter
  @search_parameter
end

#search_parameter_separatorObject

The search parameter capabilities separator (defaults to “,”)



44
45
46
# File 'lib/wurfl_cloud/configuration.rb', line 44

def search_parameter_separator
  @search_parameter_separator
end

Instance Method Details

#api_uriObject



77
78
79
# File 'lib/wurfl_cloud/configuration.rb', line 77

def api_uri
  "#{@schema}://#{@host}:#{@port}#{@path}"
end

#cache(environment) ⇒ Object

creates a cache instance using the class and the options given in the confinguration and passing whatever environment is passed in the parameters



84
85
86
# File 'lib/wurfl_cloud/configuration.rb', line 84

def cache(environment)
  @cache_class.new(@cache_options, environment)
end