Class: Vra::RequestParameter
- Inherits:
-
Object
- Object
- Vra::RequestParameter
- Defined in:
- lib/vra/request_parameters.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #format_value ⇒ Object
-
#initialize(key, type, value) ⇒ RequestParameter
constructor
A new instance of RequestParameter.
- #to_h ⇒ Object
Constructor Details
#initialize(key, type, value) ⇒ RequestParameter
Returns a new instance of RequestParameter.
40 41 42 43 44 |
# File 'lib/vra/request_parameters.rb', line 40 def initialize(key, type, value) @key = key @type = type @value = value end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
39 40 41 |
# File 'lib/vra/request_parameters.rb', line 39 def key @key end |
#type ⇒ Object
Returns the value of attribute type.
39 40 41 |
# File 'lib/vra/request_parameters.rb', line 39 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
39 40 41 |
# File 'lib/vra/request_parameters.rb', line 39 def value @value end |
Instance Method Details
#format_value ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vra/request_parameters.rb', line 56 def format_value case @type when 'integer' @value.to_i when 'string' @value.to_s else @value.to_s end end |
#to_h ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/vra/request_parameters.rb', line 46 def to_h { 'key' => @key, 'value' => { 'type' => @type, 'value' => format_value } } end |