Class: HaveAPI::Client::Parameters::Typed
- Inherits:
-
Object
- Object
- HaveAPI::Client::Parameters::Typed
- Defined in:
- lib/haveapi/client/parameters/typed.rb
Defined Under Namespace
Modules: Boolean
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(params, desc, value) ⇒ Typed
constructor
A new instance of Typed.
- #to_api ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(params, desc, value) ⇒ Typed
Returns a new instance of Typed.
21 22 23 24 25 26 |
# File 'lib/haveapi/client/parameters/typed.rb', line 21 def initialize(params, desc, value) @params = params @desc = desc @errors = [] @value = coerce(value) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
19 20 21 |
# File 'lib/haveapi/client/parameters/typed.rb', line 19 def errors @errors end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
19 20 21 |
# File 'lib/haveapi/client/parameters/typed.rb', line 19 def value @value end |
Instance Method Details
#to_api ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/haveapi/client/parameters/typed.rb', line 35 def to_api if @desc[:type] == 'Datetime' && value.is_a?(Time) value.iso8601 else value end end |