Module: AWS::Core::OptionGrammar::Descriptors::Timestamp

Extended by:
NoArgs
Defined in:
lib/aws/core/option_grammar.rb

Instance Method Summary collapse

Methods included from NoArgs

apply

Instance Method Details

#encode_value(value) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/aws/core/option_grammar.rb', line 73

def encode_value(value)
  value.to_s
  #             value.to_s
  #             case value
  #             when Integer
  #             when 
  #             case value
  #             when nil, ''  then nil
  #             when DateTime then raw
  #             when Integer  then DateTime.parse(Time.at(raw).to_s) # timestamp
  #             else DateTime.parse(raw.to_s) # work with Time, Date and String objects
  #             end
end

#validate(value, context = nil) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/aws/core/option_grammar.rb', line 56

def validate(value, context = nil)
  true
  #             raise format_error("timestamp value", context) unless
  #               case value
  #               when String 
  #                 value =~ /^\d+$/ or value =~ /^\d{4}-\d{2}-d{2}T\d{2}:\d{2}:\d{2}Z$/
  #               when String then value =~ /^2009-12-04T20:56:05.000Z\d+$/
  #               when Integer then true
  #               when DateTime then true
  #               when Timestamp then true
  #               when Date then true
  #               else false
  #               end
  #             end
  #               value.respond_to? :to_str
end