From 138684b45c7871a990573e07edb718a18450cec7 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Tue, 5 Nov 2019 19:23:59 -0800 Subject: [PATCH] Add support for `Mandate` --- .travis.yml | 2 +- lib/stripe/object_types.rb | 1 + lib/stripe/resources.rb | 1 + lib/stripe/resources/mandate.rb | 7 +++++++ test/stripe/mandate_test.rb | 14 ++++++++++++++ test/test_helper.rb | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 lib/stripe/resources/mandate.rb create mode 100644 test/stripe/mandate_test.rb diff --git a/.travis.yml b/.travis.yml index 92bfb904a..d594cd483 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ sudo: false env: global: # If changing this number, please also change it in `test/test_helper.rb`. - - STRIPE_MOCK_VERSION=0.63.0 + - STRIPE_MOCK_VERSION=0.72.0 cache: directories: diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index c1510f8d0..eb172a692 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -48,6 +48,7 @@ def self.object_names_to_classes Issuing::Dispute::OBJECT_NAME => Issuing::Dispute, Issuing::Transaction::OBJECT_NAME => Issuing::Transaction, LoginLink::OBJECT_NAME => LoginLink, + Mandate::OBJECT_NAME => Mandate, Order::OBJECT_NAME => Order, OrderReturn::OBJECT_NAME => OrderReturn, PaymentIntent::OBJECT_NAME => PaymentIntent, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 0064d5a93..b0051dad9 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -37,6 +37,7 @@ require "stripe/resources/issuing/dispute" require "stripe/resources/issuing/transaction" require "stripe/resources/login_link" +require "stripe/resources/mandate" require "stripe/resources/order" require "stripe/resources/order_return" require "stripe/resources/payment_intent" diff --git a/lib/stripe/resources/mandate.rb b/lib/stripe/resources/mandate.rb new file mode 100644 index 000000000..cd041c5e6 --- /dev/null +++ b/lib/stripe/resources/mandate.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Stripe + class Mandate < APIResource + OBJECT_NAME = "mandate" + end +end diff --git a/test/stripe/mandate_test.rb b/test/stripe/mandate_test.rb new file mode 100644 index 000000000..4f8724785 --- /dev/null +++ b/test/stripe/mandate_test.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require ::File.expand_path("../test_helper", __dir__) + +module Stripe + class MandateTest < Test::Unit::TestCase + should "be retrievable" do + schedule = Stripe::Mandate.retrieve("mandate_123") + assert_requested :get, + "#{Stripe.api_base}/v1/mandates/mandate_123" + assert schedule.is_a?(Stripe::Mandate) + end + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index c19739147..5a625a19d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -16,7 +16,7 @@ require ::File.expand_path("stripe_mock", __dir__) # If changing this number, please also change it in `.travis.yml`. -MOCK_MINIMUM_VERSION = "0.63.0" +MOCK_MINIMUM_VERSION = "0.72.0" MOCK_PORT = Stripe::StripeMock.start # Disable all real network connections except those that are outgoing to