mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-08-12 00:01:47 -04:00
Adding support for listing file uploads.
This commit is contained in:
parent
b080e9a7d1
commit
ad26262a2c
@ -18,6 +18,13 @@ module Stripe
|
||||
Util.convert_to_stripe_object(response, api_key)
|
||||
end
|
||||
|
||||
def self.all(filters={}, opts={})
|
||||
api_key, headers = Util.parse_opts(opts)
|
||||
response, api_key = Stripe.request(
|
||||
:get, self.url, api_key, filters, headers, UPLOADS_API_BASE)
|
||||
Util.convert_to_stripe_object(response, api_key)
|
||||
end
|
||||
|
||||
def refresh
|
||||
response, api_key = Stripe.request(
|
||||
:get, url, @api_key, @retrieve_options, self.class.request_headers, UPLOADS_API_BASE)
|
||||
|
@ -35,7 +35,8 @@ module Stripe
|
||||
'plan' => Plan,
|
||||
'recipient' => Recipient,
|
||||
'refund' => Refund,
|
||||
'subscription' => Subscription,
|
||||
'subscription' => Subscription,
|
||||
'file_upload' => FileUpload,
|
||||
'transfer' => Transfer
|
||||
}
|
||||
end
|
||||
|
@ -17,5 +17,12 @@ module Stripe
|
||||
c.refresh
|
||||
assert_equal 1403047735, c.created
|
||||
end
|
||||
|
||||
should "files should be listable" do
|
||||
@mock.expects(:get).once.returns(test_response(test_file_array))
|
||||
c = Stripe::FileUpload.all.data
|
||||
assert c.kind_of? Array
|
||||
assert c[0].kind_of? Stripe::FileUpload
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -185,12 +185,21 @@ module Stripe
|
||||
|
||||
def test_file(params={})
|
||||
{
|
||||
:object => "file_upload",
|
||||
:id => "fil_test_file",
|
||||
:created => 1403047735,
|
||||
:size => 4908,
|
||||
:purpose => params[:purpose] || "dispute_evidence",
|
||||
:url => nil,
|
||||
:mimetype => nil,
|
||||
:type => nil,
|
||||
}
|
||||
end
|
||||
|
||||
def test_file_array
|
||||
{
|
||||
:data => [test_file, test_file, test_file],
|
||||
:object => 'list',
|
||||
:url => '/v1/files'
|
||||
}
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user