mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-03 00:01:21 -04:00
Add support for the LineItem
resource and APIs (#918)
This commit is contained in:
parent
4c5b67bce0
commit
cfac8d7fcc
@ -17,7 +17,7 @@ sudo: false
|
||||
env:
|
||||
global:
|
||||
# If changing this number, please also change it in `test/test_helper.rb`.
|
||||
- STRIPE_MOCK_VERSION=0.89.0
|
||||
- STRIPE_MOCK_VERSION=0.90.0
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
@ -49,6 +49,7 @@ module Stripe
|
||||
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
||||
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
||||
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
||||
LineItem::OBJECT_NAME => LineItem,
|
||||
LoginLink::OBJECT_NAME => LoginLink,
|
||||
Mandate::OBJECT_NAME => Mandate,
|
||||
Order::OBJECT_NAME => Order,
|
||||
|
@ -38,6 +38,7 @@ require "stripe/resources/issuing/card_details"
|
||||
require "stripe/resources/issuing/cardholder"
|
||||
require "stripe/resources/issuing/dispute"
|
||||
require "stripe/resources/issuing/transaction"
|
||||
require "stripe/resources/line_item"
|
||||
require "stripe/resources/login_link"
|
||||
require "stripe/resources/mandate"
|
||||
require "stripe/resources/order"
|
||||
|
@ -5,8 +5,11 @@ module Stripe
|
||||
class Session < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
extend Stripe::APIOperations::NestedResource
|
||||
|
||||
OBJECT_NAME = "checkout.session"
|
||||
|
||||
nested_resource_class_methods :line_item, operations: %i[list]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
7
lib/stripe/resources/line_item.rb
Normal file
7
lib/stripe/resources/line_item.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class LineItem < APIResource
|
||||
OBJECT_NAME = "item"
|
||||
end
|
||||
end
|
@ -36,6 +36,18 @@ module Stripe
|
||||
assert_requested :get, "#{Stripe.api_base}/v1/checkout/sessions/cs_123"
|
||||
assert charge.is_a?(Stripe::Checkout::Session)
|
||||
end
|
||||
|
||||
context "#list_line_items" do
|
||||
should "list the session's line items" do
|
||||
sources = Stripe::Checkout::Session.list_line_items(
|
||||
"cs_123"
|
||||
)
|
||||
assert_requested :get, "#{Stripe.api_base}/v1/checkout/sessions/cs_123/line_items"
|
||||
assert sources.is_a?(Stripe::ListObject)
|
||||
assert sources.data.is_a?(Array)
|
||||
assert sources.data[0].is_a?(Stripe::LineItem)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
|
||||
require ::File.expand_path("stripe_mock", __dir__)
|
||||
|
||||
# If changing this number, please also change it in `.travis.yml`.
|
||||
MOCK_MINIMUM_VERSION = "0.89.0"
|
||||
MOCK_MINIMUM_VERSION = "0.90.0"
|
||||
MOCK_PORT = Stripe::StripeMock.start
|
||||
|
||||
# Disable all real network connections except those that are outgoing to
|
||||
|
Loading…
x
Reference in New Issue
Block a user