Class: Recurly::Schema::DateTimeAttribute

Inherits:
Attribute
  • Object
show all
Defined in:
lib/recurly/schema.rb

Constant Summary

Constants inherited from Attribute

Attribute::PRIMITIVE_TYPES

Instance Method Summary collapse

Methods inherited from Attribute

build, #initialize, #recurly_class

Constructor Details

This class inherits a constructor from Recurly::Schema::Attribute

Instance Method Details

#cast(value) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/recurly/schema.rb', line 116

def cast(value)
  if value.is_a?(DateTime)
    value
  else
    DateTime.parse(value)
  end
end

#is_valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/recurly/schema.rb', line 112

def is_valid?(value)
  value.is_a?(String) || value.is_a?(DateTime)
end

#typeObject



124
125
126
# File 'lib/recurly/schema.rb', line 124

def type
  DateTime
end