gocardless 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3541d1c3a98b1d8812387e1122381ccf061648d
4
- data.tar.gz: d1280282fed2de29f439389679a27165dbef197e
3
+ metadata.gz: 2e22096b949c5df3105ed9060a58824e185fd993
4
+ data.tar.gz: 1cc708492608cf07feb13e391e11c6b1e9411925
5
5
  SHA512:
6
- metadata.gz: c4238571659011a414b4ec82b8dab479c9f4bc2274ffd9f6de010e28dad76f34356d7a41be4fe49bb3b354d4a3a8818cff35bb21618c30799b9b42a53763fbec
7
- data.tar.gz: 4fe530f0bf5531541366cae496bcc8d613abca06e638b11f10d36e3aaba00ce0d2ec7246a6b3aa811a0581a8b494dedc7016f9c92737b1195d17c05858084b7e
6
+ metadata.gz: b5a4f60f99788d941ad2e0d5444fd3a83f9e26ffcb1e601fdc137de1b9c7a474f5101b183b83672180aae15bb9664393dbf5663234293defaef080c85299e099
7
+ data.tar.gz: 4e2e79bd303380b67722277a242f533887630d8f3cb9c4259a699c5da64d3aa24b48c9bd2c5ac18929c7facf97d87a3274aae65b2704d34e800e3871b585775b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.10.1 - June 09, 2014
2
+
3
+ - Use a more useful user agent header
4
+
5
+
1
6
  ## 1.10.0 - June 02, 2014
2
7
 
3
8
  - Add alias methods for boolean attributes
data/Rakefile CHANGED
@@ -43,7 +43,7 @@ def update_version_file(new_version)
43
43
  end
44
44
 
45
45
  def bump_version(part)
46
- last_version = `git tag -l | tail -1`.strip.sub(/^v/, '')
46
+ last_version = `git tag -l --sort=v:refname | tail -1`.strip.sub(/^v/, '')
47
47
  major, minor, patch = last_version.scan(/\d+/).map(&:to_i)
48
48
 
49
49
  case part
@@ -313,6 +313,19 @@ module GoCardless
313
313
  "#{base_url}#{API_PATH}"
314
314
  end
315
315
 
316
+ def user_agent
317
+ @user_agent ||=
318
+ begin
319
+ gem_info = "gocardless-ruby/v#{GoCardless::VERSION}"
320
+ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
321
+ ruby_version = RUBY_VERSION
322
+ ruby_version += " p#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL)
323
+ comment = ["#{ruby_engine} #{ruby_version}"]
324
+ comment << RUBY_PLATFORM if defined?(RUBY_PLATFORM)
325
+ "#{gem_info} (#{comment.join("; ")})"
326
+ end
327
+ end
328
+
316
329
  private
317
330
 
318
331
  # Pull the merchant id out of the access scope
@@ -332,7 +345,7 @@ module GoCardless
332
345
  opts[:headers] = {} if opts[:headers].nil?
333
346
  opts[:headers]['Accept'] = 'application/json'
334
347
  opts[:headers]['Content-Type'] = 'application/json' unless method == :get
335
- opts[:headers]['User-Agent'] = "gocardless-ruby/v#{GoCardless::VERSION}"
348
+ opts[:headers]['User-Agent'] = user_agent
336
349
  opts[:body] = MultiJson.encode(opts[:data]) if !opts[:data].nil?
337
350
 
338
351
  # Reset the URL in case the environment / base URL has been changed.
@@ -1,3 +1,3 @@
1
1
  module GoCardless
2
- VERSION = '1.10.0'.freeze
2
+ VERSION = '1.10.1'.freeze
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -512,5 +512,28 @@ describe GoCardless::Client do
512
512
  @client.base_url.should == 'http://gc.com/'
513
513
  end
514
514
  end
515
+
516
+ describe "#user_agent" do
517
+ let(:user_agent) { @client.user_agent }
518
+
519
+ it "includes the gem name" do
520
+ expect(user_agent).to include("gocardless-ruby")
521
+ puts(user_agent)
522
+ end
523
+
524
+ it "includes the gem version" do
525
+ expect(user_agent).to include("v#{GoCardless::VERSION}")
526
+ end
527
+
528
+ it "includes the ruby version" do
529
+ expect(user_agent).to include(RUBY_VERSION)
530
+ end
531
+
532
+ if defined?(RUBY_PLATFORM)
533
+ it "includes the ruby platform" do
534
+ expect(user_agent).to include(RUBY_PLATFORM)
535
+ end
536
+ end
537
+ end
515
538
  end
516
539
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocardless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Marr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-02 00:00:00.000000000 Z
12
+ date: 2014-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2