40 Commits

Author SHA1 Message Date
Olivier Bellone
ec91de6849
Upgrade Rubocop and fix a bunch of issues (#786)
* Bump Rubocop to 0.57.2

* Style/StderrPuts: Use warn instead of .puts

* Style/ExpandPathArguments: Use expand_path('../test_helper', __dir__) instead of expand_path('../../test_helper', __FILE__)

* Style/Encoding: Unnecessary utf-8 encoding comment

* Style/StringLiterals: Prefer double-quoted strings

* Style/AccessModifierDeclarations

* Style/FormatStringToken: Prefer annotated tokens

* Naming/UncommunicativeMethodParamName

* Metrics/LineLength: set maximum line length to 100 characters

* Style/IfUnlessModifier: Favor modifier if usage when having a single-line body

* Style/ClassVars

* Metrics/LineLength: set maximum line length to 80 characters (default)

* Style/AccessModifierDeclarations: EnforcedStyle: inline
2019-05-24 10:43:42 -07:00
Olivier Bellone
c80a491e03
Bump Faraday minimum version to 0.13.0 2018-11-16 13:54:26 +01:00
Brandur
85013c9770 Use Faraday's Net::HTTP::Persistent adapter
This changes the library's default connection over to use the adapter
for `Net::HTTP::Persistent`, which is a connection pooling library for
Ruby.

In the long run, I think we should probably just drop Faraday ... the
amount of value it's getting us is extremely tenuous and its API is
difficult to work with. I hate to do it at this point though because
technically people could be writing custom middleware for it.
2018-11-15 08:55:28 -08:00
Olivier Bellone
21db64fe0e
Use ::File instead of File 2018-08-27 15:32:10 +02:00
Brandur
863da48398 Add frozen_string_literal to every file and enforce Rubocop rule
Adds the magic `frozen_string_literal: true` comment to every file and
enables a Rubocop rule to make sure that it's always going to be there
going forward as well.

See here for more background [1], but the basic idea is that unlike many
other languages, static strings in code are mutable by default. This has
since been acknowledged as not a particularly good idea, and the
intention is to rectify the mistake when Ruby 3 comes out, where all
string literals will be frozen. The `frozen_string_literal` magic
comment was introduced in Ruby 2.3 as a way of easing the transition,
and allows libraries and projects to freeze their literals in advance.

I don't think this is breaking in any way: it's possible that users
might've been pulling out one of are literals somehow and mutating it,
but that would probably not have been useful for anything and would
certainly not be recommended, so I'm quite comfortable pushing this
change through as a minor version.

As discussed in #641.

[1] https://stackoverflow.com/a/37799399
2018-05-10 14:56:14 -07:00
Olivier Bellone
cd7e607258
Require Faraday 0.10 for proper nested array encoding 2017-10-05 17:56:39 +02:00
Brandur
7f85eea3ee Fix low hanging Rubocop TODOs
I wanted to see what fixing Rubocop TODOs was like, so I tried to
eliminate all the easy ones. Most of these were pretty easy, and the
changes required are relatively minimal.

Some of the stuff left is harder. Pretty much everything under
`Metrics/*` is going to be a pretty big yak shave. A few of the others
are just going to need a little more work (e.g. `Style/ClassVars` and
`Style/GuardClause`). Going to stop here for now.
2017-09-27 15:07:18 -07:00
Olivier Bellone
e02ff7f849
Start using RuboCop for linting 2017-09-27 21:28:25 +02:00
Gareth Rees
bc3abe663f Add correct required_ruby_version
The `stripe` gem installs on 1.9.3, but is unusable due to the use of keyword args.

    vagrant@vagrant-ubuntu-trusty-64: ~
    $ ruby -v
    ruby 1.9.3p551 (2014-11-13) [x86_64-linux] Brightbox

    vagrant@vagrant-ubuntu-trusty-64: ~
    $ sudo gem install stripe
    Fetching: multipart-post-2.0.0.gem (100%)
    Fetching: faraday-0.13.1.gem (100%)
    Fetching: stripe-3.3.1.gem (100%)
    Successfully installed multipart-post-2.0.0
    Successfully installed faraday-0.13.1
    Successfully installed stripe-3.3.1
    3 gems installed

    vagrant@vagrant-ubuntu-trusty-64: ~
    $ irb
    irb(main):001:0> require 'stripe'
    SyntaxError: /var/lib/gems/1.9.1/gems/stripe-3.3.1/lib/stripe.rb:207: syntax error, unexpected tLABEL
      def self.set_app_info(name, version: nil, url: nil)
                                          ^
    /var/lib/gems/1.9.1/gems/stripe-3.3.1/lib/stripe.rb:207: Can't assign to nil
      def self.set_app_info(name, version: nil, url: nil)
                                               ^
    /var/lib/gems/1.9.1/gems/stripe-3.3.1/lib/stripe.rb:225: syntax error, unexpected keyword_end, expecting $end
            from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
            from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
            from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
            from (irb):1
            from /usr/bin/irb:12:in `<main>'
2017-09-20 19:43:55 +01:00
Olivier Bellone
2c2180fc5c Fix Faraday minimum version 2017-04-07 09:40:43 -07:00
Brandur
1886d9a625 Move to an alternative system based on StripeClient 2017-02-14 12:17:37 -08:00
Brandur
aa12f7e621 Relax rest-client requirements
Our fairly old requirements for rest-client (and therefore mime-types)
are starting to cause some dependency hell problems for some customers.
Try relaxing these constraints and locking 1.9 specifically into
compatible versions.
2016-08-31 06:56:17 -07:00
Mike Chlipala
65bbee4bf8 Relax rest-client version requirements 2016-07-11 16:36:23 -07:00
JuanitoFatas
f4f8d38643 Fix homepage for Ruby docs in gemspec 2016-06-13 18:07:11 +08:00
Brandur
6920d9db68 Update authors/email in Gemspec
Unfortunately neither of these people work for Stripe anymore. Let's put
a valid contact email address in here instead.
2016-05-25 10:55:29 -07:00
Brandur
dd2bae2057 Lock Byebug to just the MRI
Here we predicate the installation of Byebug on being on the MRI. This
allows us to `bundle install` on alternate platforms like JRuby.

Also performs some Gemfile management: add latest MRI and JRuby versions
and remove special case Gemfiles.
2016-03-14 08:59:13 -07:00
Ara Hacopian
c0ef16ad1d Remove json gem dependency
All required rubies include JSON as part of the stdlib.
2016-02-09 14:12:39 -05:00
Kyle Conroy
7bf660d124 Only support Ruby >= 1.9.3
Update the README, Gemfiles, and gemspec to remove all references to
Rubies < 1.9.3.
2015-11-04 14:52:56 -08:00
Brandur
a084df78ef Add byebug/pry as a gem development dependency
I find myself using these quite a bit when looking into problems, and
currently have to manually re-add them to the Gemfile/gemspec to get
them in the bundle and make them available in tests.

Here we gate the debugger to only come in for Ruby > 2 so as to avoid
problems with various compatibility problems between debuggers and
versions of Ruby. If there's a demand for a pre-Ruby 2 debugger, we can
add that separately.

Any major objections to this one? Thanks.
2015-10-12 12:10:39 -07:00
Andy Brody
af7efeff98 Remove unnecessary dependency on mime-types.
Let rest-client depend on mime-types directly.
2015-04-14 14:49:27 -07:00
Nick Gauthier
660befd6c3 update mime-types requirement to allow 1.x and 2.x 2014-07-08 09:41:00 -04:00
Andrew Thorp
9ead81b352 replace multi_json with json, fixes #101 2014-01-24 23:27:25 -08:00
Ryan Biesemeyer
1e8062b83b Add license to gemspec. Fixes #89 2013-12-21 22:19:43 +00:00
Amber Feng
30c263bc59 Fix mime-types at 1.25 so we don't break Ruby 1.8. 2013-11-14 13:51:37 -08:00
Danny Whalen
bb9b4ecf97 Remove duplicate gemspec entries 2013-07-15 12:04:18 -07:00
Tim Craft
9ae705f845 Add version specifiers for activesupport/shoulda/mocha dev dependencies 2013-07-05 17:36:36 +01:00
Evan Broder
3354d9dddd Relax version constraint on multi_json (fixes #44)
We still need >= 1.0.4 because that's when support for pretty-printing
was introduced.
2012-11-21 13:59:14 -08:00
Greg Brockman
5caf8ece54 Update gemspec to dynamically select files 2012-06-19 23:16:02 -07:00
Evan Broder
eee7ab5c44 Add a Rakefile for running tests 2012-05-04 03:06:38 -07:00
Evan Broder
69b1e4b0bd Bump the multi_json dependency
multi_json 1.0 did not support pretty encoding
2012-05-01 16:32:56 -07:00
Evan Broder
f1d7ab6123 Drop old stripe-json vendor files from gemspec.
Fixes #24
2012-04-30 16:32:15 -07:00
Evan Broder
f8073e132a Add our own JSON abstraction to deal with MultiJson backwards compatibility
Thanks to Kevin Menard for the tip on how to approach it.
2012-04-26 13:58:20 -07:00
Evan Broder
32e619c04a Switch from deprecated MultiJson.{encode,decode} to .{dump,load}
Bump gem dependency accordingly
2012-04-23 10:18:57 -07:00
Brian Collins
a6de6e3be7 Use multi_json 2012-04-01 13:44:22 -07:00
Patrick Collison
332b0caaf4 1.4.0 -> 1.4; add rest-client declaration
Allow >= 1.4.0, < 2
Bump version to 1.5.23
2011-11-12 13:43:30 -08:00
Patrick Collison
87d3c60509 Depend on rest-client ~> 1.4.0
Fixes #7
2011-11-12 09:44:15 -08:00
Greg Brockman
6d96afa97c Add vendored JSON to gemspec 2011-08-08 19:32:59 -07:00
Greg Brockman
42f20ff6c9 Remove JSON as an explicit dependency
TODO: bundle pure Ruby JSON implementation for Ruby 1.8
2011-07-12 21:46:31 -07:00
Bradley Grzesiak
b03a4165df Remove circular dependency in gemspec 2011-07-08 17:28:50 -07:00
Greg Brockman
0813418b74 1.5.0 release 2011-05-26 11:47:01 -07:00