mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-05-31 00:00:37 -04:00
Add support for the Review resource
This commit is contained in:
parent
3c7995f030
commit
0383de9dc2
@ -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.37.0
|
||||
- STRIPE_MOCK_VERSION=0.38.0
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
@ -83,6 +83,7 @@ require "stripe/refund"
|
||||
require "stripe/reporting/report_run"
|
||||
require "stripe/reporting/report_type"
|
||||
require "stripe/reversal"
|
||||
require "stripe/review"
|
||||
require "stripe/sigma/scheduled_query_run"
|
||||
require "stripe/sku"
|
||||
require "stripe/source"
|
||||
|
14
lib/stripe/review.rb
Normal file
14
lib/stripe/review.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Review < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "review".freeze
|
||||
|
||||
def approve(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/approve", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
end
|
||||
end
|
@ -93,6 +93,7 @@ module Stripe
|
||||
Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
|
||||
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
||||
Reversal::OBJECT_NAME => Reversal,
|
||||
Review::OBJECT_NAME => Review,
|
||||
SKU::OBJECT_NAME => SKU,
|
||||
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
||||
Source::OBJECT_NAME => Source,
|
||||
|
27
test/stripe/review_test.rb
Normal file
27
test/stripe/review_test.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require ::File.expand_path("../../test_helper", __FILE__)
|
||||
|
||||
module Stripe
|
||||
class ReviewTest < Test::Unit::TestCase
|
||||
should "be listable" do
|
||||
reviews = Stripe::Review.list
|
||||
assert_requested :get, "#{Stripe.api_base}/v1/reviews"
|
||||
assert reviews.data.is_a?(Array)
|
||||
assert reviews.first.is_a?(Stripe::Review)
|
||||
end
|
||||
|
||||
should "be retrievable" do
|
||||
review = Stripe::Review.retrieve("prv_123")
|
||||
assert_requested :get, "#{Stripe.api_base}/v1/reviews/prv_123"
|
||||
assert review.is_a?(Stripe::Review)
|
||||
end
|
||||
|
||||
should "be approvable" do
|
||||
review = Stripe::Review.retrieve("prv_123")
|
||||
review.approve
|
||||
assert_requested :post, "#{Stripe.api_base}/v1/reviews/prv_123/approve"
|
||||
assert review.is_a?(Stripe::Review)
|
||||
end
|
||||
end
|
||||
end
|
@ -16,7 +16,7 @@ PROJECT_ROOT = ::File.expand_path("../../", __FILE__)
|
||||
require ::File.expand_path("../test_data", __FILE__)
|
||||
|
||||
# If changing this number, please also change it in `.travis.yml`.
|
||||
MOCK_MINIMUM_VERSION = "0.37.0".freeze
|
||||
MOCK_MINIMUM_VERSION = "0.38.0".freeze
|
||||
MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
|
||||
|
||||
# Disable all real network connections except those that are outgoing to
|
||||
|
Loading…
x
Reference in New Issue
Block a user