Class: Adminix::Entities::Variable
- Inherits:
-
Object
- Object
- Adminix::Entities::Variable
- Defined in:
- lib/adminix/entities/variable.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Variable
constructor
A new instance of Variable.
- #to_bash_export ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Variable
Returns a new instance of Variable.
22 23 24 25 |
# File 'lib/adminix/entities/variable.rb', line 22 def initialize(opts = {}) @key = opts[:key] @value = opts[:value] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/adminix/entities/variable.rb', line 4 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/adminix/entities/variable.rb', line 4 def value @value end |
Class Method Details
.all(service) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/adminix/entities/variable.rb', line 6 def self.all(service) return [] unless Adminix.config.credentials_defined? success, result = Helpers::NetHTTP.get("services/#{service.id}/options") return [] unless success variables = result.map do |o| Variable.new( key: o['key'], value: o['value'] ) end variables end |
Instance Method Details
#to_bash_export ⇒ Object
27 28 29 |
# File 'lib/adminix/entities/variable.rb', line 27 def to_bash_export "export #{key}=\"#{value}\"" end |