Skip to content

Commit

Permalink
3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Apr 12, 2021
1 parent 1da8ec3 commit a0e82af
Show file tree
Hide file tree
Showing 139 changed files with 2,190 additions and 1,770 deletions.
127 changes: 127 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Gemspec/RequiredRubyVersion:
Include:
- 'braintree.gemspec'

AllCops:
DisabledByDefault: true
TargetRubyVersion: 2.5
SuggestExtensions: false

Layout/BlockAlignment:
EnforcedStyleAlignWith: either

Layout/DotPosition:
EnforcedStyle: leading

Layout/SpaceBeforeBlockBraces:
EnforcedStyle: space

Layout/SpaceInsideBlockBraces:
EnforcedStyle: space

Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
EnforcedStyleForEmptyBraces: no_space

Layout/SpaceInsideParens:
EnforcedStyle: no_space

Layout/IndentationStyle:
EnforcedStyle: spaces
Enabled: true

Layout/TrailingWhitespace:
Enabled: true

Lint/AmbiguousOperator:
Enabled: true

Lint/AmbiguousRegexpLiteral:
Enabled: true

Lint/AssignmentInCondition:
Enabled: true

Lint/BigDecimalNew:
Enabled: true

Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true

Lint/BooleanSymbol:
Enabled: true

Lint/CircularArgumentReference:
Enabled: true

Lint/ConstantDefinitionInBlock:
Enabled: true

Lint/DeprecatedClassMethods:
Enabled: true

Lint/DeprecatedOpenSSLConstant:
Enabled: true

Lint/DisjunctiveAssignmentInConstructor:
Enabled: true

Lint/DuplicateCaseCondition:
Enabled: true

Lint/DuplicateElsifCondition:
Enabled: true

Lint/DuplicateHashKey:
Enabled: true

Lint/DuplicateMethods:
Enabled: true

Lint/DuplicateRequire:
Enabled: true

Lint/DuplicateRescueException:
Enabled: true

Lint/EachWithObjectArgument:
Enabled: true

Lint/ElseLayout:
Enabled: true

Lint/EmptyConditionalBody:
Enabled: true

Lint/EmptyEnsure:
Enabled: true

Lint/EmptyExpression:
Enabled: true

Lint/EmptyFile:
Enabled: true

Lint/EmptyInterpolation:
Enabled: true

Lint/EmptyWhen:
Enabled: true

Lint/EnsureReturn:
Enabled: true

Lint/SuppressedException:
Enabled: false

Style/DefWithParentheses:
Enabled: true

Style/EmptyMethod:
EnforcedStyle: expanded

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Changelog

## unreleased
* Add support for `ActiveSupport::TimeWithZone` when generating XML
## 3.4.0
* Add `local_payment_reversed` webhook notification
* Add `Transaction.adjust_authorization` method to support for multiple authorizations for a single transaction
* Add `merchant_account_id` parameter to `Transaction#refund`
* Add `store_id` and `store_ids` parameters to `Transaction#search`
* Add support for `ActiveSupport::TimeWithZone` when generating XML (thanks @Tonkpils!)

## 3.3.0
* Add `decision_reasons` and `transaction_risk_score` fields to `RiskData`
Expand Down Expand Up @@ -78,7 +82,7 @@
* Transaction#submit_for_settlement and Transaction#submit_for_settlement!
* Transaction#void and Transaction#void!
* Remove unused WebhookNotification::Kind::GrantedPaymentInstrumentUpdate
* Rename all Android Pay classes and methods to Google Pay
* Rename all Android Pay classes and methods to Google Pay
* Rename Dispute::HistoryEvent to Dispute::StatusHistory
* Update the following methods to return `Date`s instead of `Strings` (fixes #161):
* DisbursementDetails#disbursement_date
Expand Down
11 changes: 6 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
source "https://rubygems.org"

gem 'builder', '3.2.4'
gem 'libxml-ruby', '3.2.0'
gem "builder", "3.2.4"
gem "libxml-ruby", "3.2.0"

group :development do
gem 'pry', '0.13.1'
gem 'rake', '13.0.1'
gem 'rspec', '3.9.0'
gem "pry", "0.13.1"
gem "rake", "13.0.1"
gem "rspec", "3.9.0"
gem "rubocop", "~>1.12.0"
end
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ console: build

build:
docker build -t braintree-ruby .

lint: build
docker run -it -v="$(PWD):/braintree-ruby" --net="host" braintree-ruby /bin/bash -l -c "bundle install;rake lint"
15 changes: 10 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ task :dev_console do
sh "irb -I lib -rubygems -r braintree -r env/development"
end

task :lint do
puts "Running rubocop for linting, you can autocorrect by running `rubocop -a`"
sh "rubocop"
end

namespace :test do

# Usage:
# rake test:unit
# rake test:unit[configuration_spec]
# rake test:unit[configuration_spec,"accepts merchant credentials"]
desc "Run unit tests"
task :unit, [:file_name, :test_name] do |task, args|
task :unit, [:file_name, :test_name] => [:lint] do |task, args|
if args.file_name.nil?
sh "rspec --pattern spec/unit/**/*_spec.rb"
elsif args.test_name.nil?
Expand All @@ -29,7 +34,7 @@ namespace :test do
# rake test:integration[plan_spec]
# rake test:integration[plan_spec,"gets all plans"]
desc "Run integration tests"
task :integration, [:file_name, :test_name] do |task, args|
task :integration, [:file_name, :test_name] => [:lint] do |task, args|
if args.file_name.nil?
sh "rspec --pattern spec/integration/**/*_spec.rb"
elsif args.test_name.nil?
Expand All @@ -45,14 +50,14 @@ end
task :test => "test:all"

task :gem do
exec('gem build braintree.gemspec')
exec("gem build braintree.gemspec")
end

require File.dirname(__FILE__) + "/lib/braintree/configuration.rb"

desc 'Cleans generated files'
desc "Cleans generated files"
task :clean do
rm_f Dir.glob('*.gem').join(" ")
rm_f Dir.glob("*.gem").join(" ")
rm_rf "rdoc"
rm_rf "bt_rdoc"
end
2 changes: 1 addition & 1 deletion braintree.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$:.push File.expand_path("../lib", __FILE__)
require 'braintree/version'
require "braintree/version"

Gem::Specification.new do |s|
s.name = "braintree"
Expand Down
3 changes: 2 additions & 1 deletion lib/braintree.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'base64'
require "base64"
require "bigdecimal"
require "cgi"
require "date"
Expand Down Expand Up @@ -71,6 +71,7 @@
require "braintree/graphql_client"
require "braintree/google_pay_card"
require "braintree/local_payment_completed"
require "braintree/local_payment_reversed"
require "braintree/transaction/local_payment_details"
require "braintree/merchant"
require "braintree/merchant_gateway"
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/account_updater_daily_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AccountUpdaterDailyReport # :nodoc:
class << self
protected :new
def _new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class << self
end

def self._new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end
end
2 changes: 1 addition & 1 deletion lib/braintree/apple_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class << self
end

def self._new(*args) # :nodoc:
self.new *args
self.new(*args)
end

def self.register_domain(domain)
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/apple_pay_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class << self
end

def self._new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end
end
2 changes: 1 addition & 1 deletion lib/braintree/apple_pay_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class << self
end

def self._new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end
end
2 changes: 1 addition & 1 deletion lib/braintree/authorization_adjustment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AuthorizationAdjustment # :nodoc:
class << self
protected :new
def _new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/client_token.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'json'
require "json"

module Braintree
module ClientToken
Expand Down
22 changes: 11 additions & 11 deletions lib/braintree/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class Configuration
]

class << self
attr_writer *WRITABLE_ATTRIBUTES
attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
attr_writer(*WRITABLE_ATTRIBUTES)
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
end
attr_reader *READABLE_ATTRIBUTES
attr_reader *NON_REQUIRED_READABLE_ATTRIBUTES
attr_writer *WRITABLE_ATTRIBUTES
attr_reader(*READABLE_ATTRIBUTES)
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
attr_writer(*WRITABLE_ATTRIBUTES)

def self.expectant_reader(*attributes) # :nodoc:
attributes.each do |attribute|
Expand All @@ -56,7 +56,7 @@ def self.expectant_reader(*attributes) # :nodoc:
end
end
end
expectant_reader *READABLE_ATTRIBUTES
expectant_reader(*READABLE_ATTRIBUTES)

# Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
def self.environment=(env)
Expand Down Expand Up @@ -86,7 +86,7 @@ def self.instantiate # :nodoc:
:proxy_port => proxy_port,
:proxy_user => proxy_user,
:proxy_pass => proxy_pass,
:ssl_version => ssl_version
:ssl_version => ssl_version,
)
end

Expand Down Expand Up @@ -205,7 +205,7 @@ def logger
def port # :nodoc:
case @environment
when :development, :integration
ENV['GATEWAY_PORT'] || 3000
ENV["GATEWAY_PORT"] || 3000
when :production, :qa, :sandbox
443
end
Expand All @@ -214,7 +214,7 @@ def port # :nodoc:
def graphql_port # :nodoc:
case @environment
when :development, :integration
ENV['GRAPHQL_PORT'] || 8080
ENV["GRAPHQL_PORT"] || 8080
when :production, :qa, :sandbox
443
end
Expand All @@ -235,7 +235,7 @@ def http_read_timeout
def server # :nodoc:
case @environment
when :development, :integration
ENV['GATEWAY_HOST'] || "localhost"
ENV["GATEWAY_HOST"] || "localhost"
when :production
"#{endpoint}.braintreegateway.com"
when :qa
Expand All @@ -248,7 +248,7 @@ def server # :nodoc:
def graphql_server # :nodoc:
case @environment
when :development, :integration
ENV['GRAPHQL_HOST'] || "graphql.bt.local"
ENV["GRAPHQL_HOST"] || "graphql.bt.local"
when :production
"payments.braintree-api.com"
when :qa
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/connected_merchant_paypal_status_changed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(attributes)
class << self
protected :new
def _new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/connected_merchant_status_transitioned.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(attributes)
class << self
protected :new
def _new(*args) # :nodoc:
self.new *args
self.new(*args)
end
end
end
Expand Down
Loading

0 comments on commit a0e82af

Please sign in to comment.