Sha256: 283115b41e177ee2a4984368be89437f8455b817fd73f755b5a06687321ce4bb

Contents?: true

Size: 575 Bytes

Versions: 30

Compression:

Stored size: 575 Bytes

Contents

module ActiveZuora
  class DateTimeField < Field

    def type_cast(value)
      return value if value.nil? || value.is_a?(Date)
      return value.to_datetime if value.is_a?(Time)
      value.to_datetime rescue default
    end

    def build_xml(xml, soap, value, options={})
      # All dates need to be in PST time.  Since all user-set attributes
      # in Zuora are really only dates, we'll chop off the time.
      # 2012-05-22T00:00:00-08:00
      value = value ? value.strftime("%Y-%m-%dT00:00:00-08:00") : ''
      super(xml, soap, value, options)
    end

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
active_zuora-2.1.2 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.1.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.6 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.1.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.5 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.4 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.3 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.2 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.0.0 lib/active_zuora/fields/date_time_field.rb