Adds support for 'partner_id' in 'set_app_info' (#658)

* Adds support for 'partner_id' in 'set_app_info'

Signed-off-by: zach wick <zwick@stripe.com>
This commit is contained in:
zach wick 2018-06-28 11:55:58 -04:00 committed by Brandur
parent 32151d5a31
commit ab3949b8da
4 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2018-02-23 14:17:07 +0100 using RuboCop version 0.50.0. # on 2018-06-28 10:59:56 -0400 using RuboCop version 0.50.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -13,18 +13,18 @@ Metrics/AbcSize:
# Offense count: 27 # Offense count: 27
# Configuration parameters: CountComments, ExcludedMethods. # Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength: Metrics/BlockLength:
Max: 496 Max: 498
# Offense count: 8 # Offense count: 8
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/ClassLength: Metrics/ClassLength:
Max: 624 Max: 626
# Offense count: 11 # Offense count: 11
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 15 Max: 15
# Offense count: 259 # Offense count: 269
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https # URISchemes: http, https
Metrics/LineLength: Metrics/LineLength:
@ -55,6 +55,6 @@ Style/ClassVars:
- 'lib/stripe/stripe_object.rb' - 'lib/stripe/stripe_object.rb'
- 'test/stripe/api_resource_test.rb' - 'test/stripe/api_resource_test.rb'
# Offense count: 53 # Offense count: 55
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false

View File

@ -213,10 +213,11 @@ module Stripe
# with API requests. Useful for plugin authors to identify their plugin when # with API requests. Useful for plugin authors to identify their plugin when
# communicating with Stripe. # communicating with Stripe.
# #
# Takes a name and optional version and plugin URL. # Takes a name and optional partner program ID, plugin URL, and version.
def self.set_app_info(name, version: nil, url: nil) def self.set_app_info(name, partner_id: nil, url: nil, version: nil)
@app_info = { @app_info = {
name: name, name: name,
partner_id: partner_id,
url: url, url: url,
version: version, version: version,
} }

View File

@ -345,6 +345,7 @@ module Stripe
old = Stripe.app_info old = Stripe.app_info
Stripe.set_app_info( Stripe.set_app_info(
"MyAwesomePlugin", "MyAwesomePlugin",
partner_id: "partner_1234",
url: "https://myawesomeplugin.info", url: "https://myawesomeplugin.info",
version: "1.2.34" version: "1.2.34"
) )
@ -361,6 +362,7 @@ module Stripe
assert_equal({ assert_equal({
name: "MyAwesomePlugin", name: "MyAwesomePlugin",
partner_id: "partner_1234",
url: "https://myawesomeplugin.info", url: "https://myawesomeplugin.info",
version: "1.2.34", version: "1.2.34",
}, data[:application]) }, data[:application])

View File

@ -21,11 +21,13 @@ class StripeTest < Test::Unit::TestCase
old = Stripe.app_info old = Stripe.app_info
Stripe.set_app_info( Stripe.set_app_info(
"MyAwesomePlugin", "MyAwesomePlugin",
partner_id: "partner_1234",
url: "https://myawesomeplugin.info", url: "https://myawesomeplugin.info",
version: "1.2.34" version: "1.2.34"
) )
assert_equal({ assert_equal({
name: "MyAwesomePlugin", name: "MyAwesomePlugin",
partner_id: "partner_1234",
url: "https://myawesomeplugin.info", url: "https://myawesomeplugin.info",
version: "1.2.34", version: "1.2.34",
}, Stripe.app_info) }, Stripe.app_info)