-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Stripe | ||
class FileLink < APIResource | ||
extend Stripe::APIOperations::Create | ||
include Stripe::APIOperations::Save | ||
extend Stripe::APIOperations::List | ||
|
||
OBJECT_NAME = "file_link".freeze | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require File.expand_path("../../test_helper", __FILE__) | ||
|
||
module Stripe | ||
class FileLinkTest < Test::Unit::TestCase | ||
should "be listable" do | ||
file_links = Stripe::FileLink.list | ||
assert_requested :get, "#{Stripe.api_base}/v1/file_links" | ||
assert file_links.data.is_a?(Array) | ||
assert file_links.first.is_a?(Stripe::FileLink) | ||
end | ||
|
||
should "be retrievable" do | ||
file_link = Stripe::FileLink.retrieve("link_123") | ||
assert_requested :get, "#{Stripe.api_base}/v1/file_links/link_123" | ||
assert file_link.is_a?(Stripe::FileLink) | ||
end | ||
|
||
should "be creatable" do | ||
file_link = Stripe::FileLink.create( | ||
file: "file_123", | ||
) | ||
assert_requested :post, "#{Stripe.api_base}/v1/file_links" | ||
assert file_link.is_a?(Stripe::FileLink) | ||
end | ||
|
||
should "be saveable" do | ||
file_link = Stripe::FileLink.retrieve("link_123") | ||
file_link.metadata["key"] = "value" | ||
file_link.save | ||
assert_requested :post, "#{Stripe.api_base}/v1/file_links/#{file_link.id}" | ||
end | ||
|
||
should "be updateable" do | ||
file_link = Stripe::FileLink.update("link_123", metadata: { key: "value" }) | ||
assert_requested :post, "#{Stripe.api_base}/v1/file_links/link_123" | ||
assert file_link.is_a?(Stripe::FileLink) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters