Sha256: 41810722eb6574fdcc33223c9ff2f1134bbde2f3df15acdf148ffc8397b7b3cb

Contents?: true

Size: 734 Bytes

Versions: 35

Compression:

Stored size: 734 Bytes

Contents

module Recurly
  class Item < Resource
    # @return [[CustomField], []]
    has_many :custom_fields, class_name: :CustomField, readonly: false

    define_attribute_methods %w(
      item_code
      name
      description
      external_sku
      accounting_code
      revenue_schedule_type
      state
      avalara_transaction_type
      avalara_service_type
      created_at
      updated_at
      deleted_at
    )

    def changed_attributes
      attrs = super
      if custom_fields.any?(&:changed?)
        attrs['custom_fields'] = custom_fields.select(&:changed?)
      end
      attrs
    end

    def reactivate
      return false unless link? :reactivate
      reload follow_link :reactivate
      true
    end

  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
recurly-2.19.10 lib/recurly/item.rb
recurly-2.19.9 lib/recurly/item.rb
recurly-2.19.8 lib/recurly/item.rb
recurly-2.19.7 lib/recurly/item.rb
recurly-2.19.6 lib/recurly/item.rb
recurly-2.19.5 lib/recurly/item.rb
recurly-2.19.4 lib/recurly/item.rb
recurly-2.19.3 lib/recurly/item.rb
recurly-2.19.2 lib/recurly/item.rb
recurly-2.19.1 lib/recurly/item.rb
recurly-2.19.0 lib/recurly/item.rb
recurly-2.18.34 lib/recurly/item.rb
recurly-2.18.33 lib/recurly/item.rb
recurly-2.18.32 lib/recurly/item.rb
recurly-2.18.31 lib/recurly/item.rb
recurly-2.18.30 lib/recurly/item.rb
recurly-2.18.29 lib/recurly/item.rb
recurly-2.18.28 lib/recurly/item.rb
recurly-2.18.27 lib/recurly/item.rb
recurly-2.18.26 lib/recurly/item.rb