Class: OData::Properties::DateTimeOffset
- Inherits:
-
OData::Property
- Object
- OData::Property
- OData::Properties::DateTimeOffset
- Defined in:
- lib/odata/properties/date_time_offset.rb
Overview
Defines the DateTimeOffset OData type.
Instance Attribute Summary
Attributes inherited from OData::Property
Instance Method Summary collapse
-
#type ⇒ Object
The OData type name.
-
#value ⇒ DateTime?
Returns the property value, properly typecast.
-
#value=(new_value) ⇒ Object
Sets the property value.
Methods inherited from OData::Property
#==, #allows_nil?, #concurrency_mode, #initialize, #to_xml, #url_value, #xml_value
Constructor Details
This class inherits a constructor from OData::Property
Instance Method Details
#type ⇒ Object
The OData type name
23 24 25 |
# File 'lib/odata/properties/date_time_offset.rb', line 23 def type 'Edm.DateTimeOffset' end |
#value ⇒ DateTime?
Returns the property value, properly typecast
7 8 9 10 11 12 13 |
# File 'lib/odata/properties/date_time_offset.rb', line 7 def value if (@value.nil? || @value.empty?) && allow_nil? nil else ::DateTime.strptime(@value, '%Y-%m-%dT%H:%M:%S.%LZ%:z') end end |
#value=(new_value) ⇒ Object
Sets the property value
17 18 19 20 |
# File 'lib/odata/properties/date_time_offset.rb', line 17 def value=(new_value) validate(new_value) @value = parse_value(new_value) end |