Class: DeviceCloud::Config
- Inherits:
-
Object
- Object
- DeviceCloud::Config
- Defined in:
- lib/device_cloud/config.rb
Constant Summary collapse
- DEFAULT_USERNAME =
""
- DEFAULT_PASSWORD =
""
- DEFAULT_HOST =
"login.etherios.com"
- DEFAULT_PROTOCOL =
"https"
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#init_with(args) ⇒ Object
YAML Initializer.
-
#initialize(args) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(args) ⇒ Config
Returns a new instance of Config.
10 11 12 13 |
# File 'lib/device_cloud/config.rb', line 10 def initialize(args) args = Hash[*args.map { |k, v| [k.to_s, v] }.flatten] unless args.nil? init_with args end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/device_cloud/config.rb', line 8 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/device_cloud/config.rb', line 8 def password @password end |
#protocol ⇒ Object
Returns the value of attribute protocol.
8 9 10 |
# File 'lib/device_cloud/config.rb', line 8 def protocol @protocol end |
#username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/device_cloud/config.rb', line 8 def username @username end |
Instance Method Details
#init_with(args) ⇒ Object
YAML Initializer
16 17 18 19 20 21 |
# File 'lib/device_cloud/config.rb', line 16 def init_with(args) @username = args["username"] || DEFAULT_USERNAME @password = args["password"] || DEFAULT_PASSWORD @host = args["host"] || DEFAULT_HOST @protocol = args["protocol"] || DEFAULT_PROTOCOL end |