Class: AuthorizeNet::Reporting::ReturnedItem

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/authorize_net/reporting/returned_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Model

#initialize, #to_a

Instance Attribute Details

#codeObject

Returns the value of attribute code.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def code
  @code
end

#date_localObject

Returns the value of attribute date_local.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def date_local
  @date_local
end

#date_utcObject

Returns the value of attribute date_utc.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def date_utc
  @date_utc
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def description
  @description
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def id
  @id
end

#returned_itemsObject

Returns the value of attribute returned_items.



6
7
8
# File 'lib/authorize_net/reporting/returned_item.rb', line 6

def returned_items
  @returned_items
end

Instance Method Details

#add_returned_item(id = nil, date_utc = nil, date_local = nil, code = nil, description = nil) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/authorize_net/reporting/returned_item.rb', line 24

def add_returned_item(id = nil, date_utc = nil, date_local = nil, code = nil, description = nil)
  if id.kind_of?(AuthorizeNet::Reporting::ReturnedItem)
    returned_item = id
  else
    returned_item = AuthorizeNet::Reporting::ReturnedItem.new({:return_item_id => id, :return_item_date_utc => date_utc, :return_item_date_local => date_local, :return_item_code => code, :line_item_description => description})
  end
  @returned_items = @returned_items.to_a << returned_item
end

#to_hashObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/authorize_net/reporting/returned_item.rb', line 33

def to_hash
  hash = {
      :id => @id,
      :date_utc => @date_utc,
      :date_local => @date_local,
      :code => @code,
      :description => @description,
      :returned_items => handle_multivalue_hashing(@returned_items)
  }
  hash.delete_if { |k, v| v.nil? }
  hash
end