Method: AuthorizeNet::Transaction#set_fields
- Defined in:
- lib/authorize_net/transaction.rb
#set_fields(fields = {}) ⇒ Object
Sets arbitrary API fields, overwriting existing values if they exist. Takes a hash of key/value pairs, where the keys are the field names without the “x_” prefix. You can set a field to Nil to unset it. If the value is an array, each value in the array will be added. For example, set_fields(=> [“item1<|>golf balls<|><|>2<|>18.95<|>Y”, “item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>”]) would generate two x_line_item fields in the transaction. One for each value in the array.
25 26 27 28 29 |
# File 'lib/authorize_net/transaction.rb', line 25 def set_fields(fields = {}) @fields.merge!(fields) @fields.reject! {|k, v| v.nil?} @fields end |