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.6.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.5.4 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.5.3 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.5.2 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.5.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.5.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.4.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.4.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.3.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.3.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.7 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.6 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.5 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.4 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.3 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.2 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.1 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.2.0 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.1.4 lib/active_zuora/fields/date_time_field.rb
active_zuora-2.1.3 lib/active_zuora/fields/date_time_field.rb