lib/stripe/util.rb in stripe-1.23.0 vs lib/stripe/util.rb in stripe-1.24.0
- old
+ new
@@ -37,14 +37,16 @@
'plan' => Plan,
'recipient' => Recipient,
'refund' => Refund,
'subscription' => Subscription,
'file_upload' => FileUpload,
+ 'token' => Token,
'transfer' => Transfer,
'transfer_reversal' => Reversal,
'bitcoin_receiver' => BitcoinReceiver,
- 'bitcoin_transaction' => BitcoinTransaction
+ 'bitcoin_transaction' => BitcoinTransaction,
+ 'dispute' => Dispute
}
end
def self.convert_to_stripe_object(resp, opts)
case resp
@@ -108,17 +110,27 @@
def self.flatten_params_array(value, calculated_key)
result = []
value.each do |elem|
if elem.is_a?(Hash)
- result += flatten_params(elem, calculated_key)
+ result += flatten_params(elem, "#{calculated_key}[]")
elsif elem.is_a?(Array)
result += flatten_params_array(elem, calculated_key)
else
result << ["#{calculated_key}[]", elem]
end
end
result
+ end
+
+ def self.normalize_id(id)
+ if id.kind_of?(Hash) # overloaded id
+ params_hash = id.dup
+ id = params_hash.delete(:id)
+ else
+ params_hash = {}
+ end
+ [id, params_hash]
end
# The secondary opts argument can either be a string or hash
# Turn this value into an api_key and a set of headers
def self.normalize_opts(opts)