diff --git a/.travis.yml b/.travis.yml index ccf40786d..8ee1bede4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ sudo: false env: global: # If changing this number, please also change it in `test/test_helper.rb`. - - STRIPE_MOCK_VERSION=0.24.1 + - STRIPE_MOCK_VERSION=0.25.0 cache: directories: diff --git a/lib/stripe.rb b/lib/stripe.rb index 7a668765a..774159291 100644 --- a/lib/stripe.rb +++ b/lib/stripe.rb @@ -55,6 +55,7 @@ require "stripe/ephemeral_key" require "stripe/event" require "stripe/exchange_rate" +require "stripe/file_link" require "stripe/file_upload" require "stripe/invoice" require "stripe/invoice_item" diff --git a/lib/stripe/file_link.rb b/lib/stripe/file_link.rb new file mode 100644 index 000000000..df9cc5901 --- /dev/null +++ b/lib/stripe/file_link.rb @@ -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 diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index 17587c8c5..e1ea19cbd 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -64,6 +64,7 @@ def self.object_classes # rubocop:disable Metrics/MethodLength EphemeralKey::OBJECT_NAME => EphemeralKey, Event::OBJECT_NAME => Event, ExchangeRate::OBJECT_NAME => ExchangeRate, + FileLink::OBJECT_NAME => FileLink, FileUpload::OBJECT_NAME => FileUpload, Invoice::OBJECT_NAME => Invoice, InvoiceItem::OBJECT_NAME => InvoiceItem, diff --git a/test/stripe/file_link_test.rb b/test/stripe/file_link_test.rb new file mode 100644 index 000000000..a6d9020f8 --- /dev/null +++ b/test/stripe/file_link_test.rb @@ -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 diff --git a/test/test_helper.rb b/test/test_helper.rb index 21cbfbbfc..9073ad0b1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -16,7 +16,7 @@ require File.expand_path("../test_data", __FILE__) # If changing this number, please also change it in `.travis.yml`. -MOCK_MINIMUM_VERSION = "0.24.1".freeze +MOCK_MINIMUM_VERSION = "0.25.0".freeze MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111 # Disable all real network connections except those that are outgoing to