Class: UserApp::ClientOptions
- Inherits:
-
Object
- Object
- UserApp::ClientOptions
- Defined in:
- lib/userapp/client_options.rb
Constant Summary collapse
- @@instance =
nil
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#base_address ⇒ Object
Returns the value of attribute base_address.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#secure ⇒ Object
Returns the value of attribute secure.
-
#throw_errors ⇒ Object
Returns the value of attribute throw_errors.
-
#token ⇒ Object
Returns the value of attribute token.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ ClientOptions
constructor
A new instance of ClientOptions.
- #set(args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ ClientOptions
Returns a new instance of ClientOptions.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/userapp/client_options.rb', line 16 def initialize(*args) @version = 1 @base_address = 'api.userapp.io' @throw_errors = true @secure = true @debug = false if !args.nil? if args.length == 1 and args[0].class == Hash args = args[0] end self.set(args) end end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
8 9 10 |
# File 'lib/userapp/client_options.rb', line 8 def app_id @app_id end |
#base_address ⇒ Object
Returns the value of attribute base_address.
10 11 12 |
# File 'lib/userapp/client_options.rb', line 10 def base_address @base_address end |
#debug ⇒ Object
Returns the value of attribute debug.
13 14 15 |
# File 'lib/userapp/client_options.rb', line 13 def debug @debug end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/userapp/client_options.rb', line 14 def logger @logger end |
#secure ⇒ Object
Returns the value of attribute secure.
12 13 14 |
# File 'lib/userapp/client_options.rb', line 12 def secure @secure end |
#throw_errors ⇒ Object
Returns the value of attribute throw_errors.
11 12 13 |
# File 'lib/userapp/client_options.rb', line 11 def throw_errors @throw_errors end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/userapp/client_options.rb', line 9 def token @token end |
#version ⇒ Object
Returns the value of attribute version.
7 8 9 |
# File 'lib/userapp/client_options.rb', line 7 def version @version end |
Class Method Details
.get_global(*args) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/userapp/client_options.rb', line 47 def self.get_global(*args) if @@instance.nil? @@instance = ClientOptions.new(args) end return @@instance end |
Instance Method Details
#set(args) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/userapp/client_options.rb', line 39 def set(args) args.each do | key, value | if key and self.respond_to?(key) self.send("#{key}=", value) end end end |