payjp 0.0.4 → 0.0.8

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
- SHA1:
3
- metadata.gz: 73a26dcd390d3d68c2fba6c82f17ca3dee4c629d
4
- data.tar.gz: 1c5731750ab0c3aeb61db20af7dbdb78206d95fd
2
+ SHA256:
3
+ metadata.gz: 21b1328487d0db17d3b7e78afe2b1a9f00df6506c2da1b896c216eec238b4936
4
+ data.tar.gz: 6416cc480d88f3fcf135ed0005ee37a2d2d8d70e4d10c7ed4fa68f9a408dbe78
5
5
  SHA512:
6
- metadata.gz: 4906c39eb253dc0b2361c8752354c91c5c6e52c734f7a54bebbc188c7d3042901bd68e1abec0f0cce44280c374e4143f8023b0b7b8c2271a65950b549efbb6d9
7
- data.tar.gz: c2455852728ca0bfadd8fcf3328788f3fbf5f90148660ac9427d528f56801bc51808b90fb04e92bc60ff68128570c997634fc69cd79f49c76d091499bee3b73c
6
+ metadata.gz: 9d907d975eb58780bd31183c3e6fd68fa99c21fa34bcbe545be98b8d9f18453d822c1cb98e7f6020235dbcf70aeedaf3e2b5022132b97c62671be847d5326923
7
+ data.tar.gz: 0be34aabaceb678126e61f71d8a0832140972f554789e135e043693996cf288875aa196383fe3f97b87073e448df265ed028ffc32c3bf26ac1a3ce10226a7be7
@@ -0,0 +1,20 @@
1
+ name: Ruby Build Test
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build-test:
7
+
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby-version: [2.0.0, 2.1, 2.2, 2.3.0, jruby-9.2.17.0]
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby ${{ matrix.ruby-version }}
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby-version }}
18
+ bundler-cache: true
19
+ - name: Run tests
20
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,7 +1,55 @@
1
- /payjp-*.gem
2
- /Gemfile.lock
1
+ ### https://raw.github.com/github/gitignore/e287eac7617fc65e49cf6e9d61ba23ff64e5994e/Ruby.gitignore
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /spec/examples.txt
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ # Used by dotenv library to load environment variables.
16
+ # .env
17
+
18
+ ## Specific to RubyMotion:
19
+ .dat*
20
+ .repl_history
21
+ build/
22
+ *.bridgesupport
23
+ build-iPhoneOS/
24
+ build-iPhoneSimulator/
25
+
26
+ ## Specific to RubyMotion (use of CocoaPods):
27
+ #
28
+ # We recommend against adding the Pods directory to your .gitignore. However
29
+ # you should judge for yourself, the pros and cons are mentioned at:
30
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
31
+ #
32
+ # vendor/Pods/
33
+
34
+ ## Documentation cache and generated files:
35
+ /.yardoc/
36
+ /_yardoc/
37
+ /doc/
38
+ /rdoc/
39
+
40
+ ## Environment normalization:
41
+ /.bundle/
42
+ /vendor/bundle
43
+ /lib/bundler/man/
44
+
45
+ # for a library or gem, you might want to ignore these files since the code is
46
+ # intended to run in multiple environments; otherwise, check them in:
47
+ # Gemfile.lock
48
+ # .ruby-version
49
+ # .ruby-gemset
50
+
51
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
3
52
  .rvmrc
53
+
54
+
4
55
  Gemfile.lock
5
- .idea/*
6
- .ruby-version
7
- pkg/*
data/Gemfile CHANGED
@@ -1,8 +1,2 @@
1
1
  source "https://rubygems.org"
2
- gemspec
3
-
4
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('1.9.3')
5
- gem 'i18n', '< 0.7'
6
- gem 'rest-client', '~> 1.6.8'
7
- gem 'activesupport', '~> 3.2'
8
- end
2
+ gemspec
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # PAY.JP for Ruby
2
+
3
+ ## How to Use
4
+
5
+ ```ruby
6
+ require 'payjp'
7
+ Payjp.api_key = 'sk_test_c62fade9d045b54cd76d7036'
8
+ Payjp.open_timeout = 30 # optionally
9
+ Payjp.read_timeout = 90 # optionally
10
+
11
+ # ex, create charge
12
+ charge = Payjp::Charge.create(
13
+ :amount => 3500,
14
+ :card => 'token_id',
15
+ :currency => 'jpy',
16
+ )
17
+ ```
18
+
19
+ | `Payjp` variables | type | required | description |
20
+ | ----------------- | ---- | -------- | ----------- |
21
+ | api_key | String | yes | your secret key |
22
+ | open_timeout | Integer | no | the second to wait for TCP connection opening (default 30) |
23
+ | read_timeout | Integer | no | the second to wait from request to reading response (default 90) |
24
+
25
+ For detail, See [PAY.JP API Docs](https://pay.jp/docs/api/)
26
+
27
+ ## Installation
28
+
29
+ ```sh
30
+ gem install payjp
31
+ ```
32
+
33
+ If you want to build the gem from source:
34
+
35
+ ```sh
36
+ gem build payjp.gemspec
37
+ ```
38
+
39
+ ### Requirements
40
+
41
+ * Ruby 2.0.0 or above.
42
+ * rest-client
43
+
44
+ ### Bundler
45
+
46
+ If you are installing via bundler, you should be sure to use the https
47
+ rubygems source in your Gemfile, as any gems fetched over http could potentially be
48
+ compromised in transit and alter the code of gems fetched securely over https:
49
+
50
+ ```
51
+ source 'https://rubygems.org'
52
+
53
+ gem 'rails'
54
+ gem 'payjp'
55
+ ```
56
+
57
+ ## Development
58
+
59
+ Test cases can be run with: `bundle exec rake test`
@@ -1,13 +1,13 @@
1
1
  module Payjp
2
2
  module APIOperations
3
3
  module Update
4
- def save(params = {})
4
+ def save(params = {}, opts = {})
5
5
  values = self.class.serialize_params(self).merge(params)
6
6
 
7
7
  if values.length > 0
8
8
  values.delete(:id)
9
9
 
10
- response, opts = request(:post, url, values)
10
+ response, opts = request(:post, url, values, opts)
11
11
  refresh_from(response, opts)
12
12
  end
13
13
  self
data/lib/payjp/charge.rb CHANGED
@@ -14,6 +14,11 @@ module Payjp
14
14
  refresh_from(response, opts)
15
15
  end
16
16
 
17
+ def reauth(params = {}, opts = {})
18
+ response, opts = request(:post, reauth_url, params, opts)
19
+ refresh_from(response, opts)
20
+ end
21
+
17
22
  private
18
23
 
19
24
  def refund_url
@@ -23,5 +28,9 @@ module Payjp
23
28
  def capture_url
24
29
  url + '/capture'
25
30
  end
31
+
32
+ def reauth_url
33
+ url + '/reauth'
34
+ end
26
35
  end
27
36
  end
@@ -129,7 +129,7 @@ module Payjp
129
129
  # remove keys at the server, but not known locally
130
130
  if @original_values.include?(key)
131
131
  keys_to_unset = @original_values[key].keys - new_keys
132
- keys_to_unset.each { |key| update[key] = '' }
132
+ keys_to_unset.each { |unset_key| update[unset_key] = '' }
133
133
  end
134
134
 
135
135
  update
data/lib/payjp/util.rb CHANGED
@@ -62,7 +62,16 @@ module Payjp
62
62
  end
63
63
 
64
64
  def self.url_encode(key)
65
- URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
65
+ # URI.escape is obsolete, so just use the code fragment in URI library
66
+ # (from URI::RFC2396_Parser#escape)
67
+ key.to_s.gsub(Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) do
68
+ us = $&
69
+ tmp = ''
70
+ us.each_byte do |uc|
71
+ tmp << sprintf('%%%02X', uc)
72
+ end
73
+ tmp
74
+ end.force_encoding(Encoding::US_ASCII)
66
75
  end
67
76
 
68
77
  def self.flatten_params(params, parent_key = nil)
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.8'
3
3
  end
data/lib/payjp.rb CHANGED
@@ -46,27 +46,43 @@ require 'payjp/errors/authentication_error'
46
46
  module Payjp
47
47
  @api_base = 'https://api.pay.jp'
48
48
  @open_timeout = 30
49
- @read_timeout = 80
49
+ @read_timeout = 90
50
50
  @ssl_ca_file = nil
51
51
  @ssl_ca_path = nil
52
52
  @ssl_cert_store = nil
53
+ @max_retry = 0
54
+ @retry_initial_delay = 2
55
+ @retry_max_delay = 32
53
56
 
54
57
  class << self
55
58
  attr_accessor :api_key, :api_base, :api_version, :connect_base, :uploads_base,
56
- :open_timeout, :read_timeout, :ssl_ca_file, :ssl_ca_path, :ssl_cert_store
59
+ :open_timeout, :read_timeout, :ssl_ca_file, :ssl_ca_path, :ssl_cert_store, :max_retry, :retry_initial_delay, :retry_max_delay
57
60
  end
58
61
 
59
62
  def self.api_url(url = '', api_base_url = nil)
60
63
  (api_base_url || @api_base) + url
61
64
  end
62
65
 
63
- def self.request(method, url, api_key, params = {}, headers = {}, api_base_url = nil, open_timeout = nil, read_timeout = nil, ssl_ca_file = nil, ssl_ca_path = nil, ssl_cert_store = nil)
66
+ def self.get_retry_delay(retry_count, retry_initial_delay, retry_max_delay)
67
+ # Get retry delay seconds.
68
+ # Based on "Exponential backoff with equal jitter" algorithm.
69
+ # https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/
70
+
71
+ wait = [retry_max_delay, retry_initial_delay * 2 ** retry_count].min
72
+ random = Random.new()
73
+ (wait / 2) + (random.rand(wait / 2.0))
74
+ end
75
+
76
+ def self.request(method, url, api_key, params = {}, headers = {}, api_base_url = nil, open_timeout = nil, read_timeout = nil, ssl_ca_file = nil, ssl_ca_path = nil, ssl_cert_store = nil, max_retry = nil, retry_initial_delay= nil, retry_max_delay = nil)
64
77
  api_base_url ||= @api_base
65
78
  open_timeout ||= @open_timeout
66
79
  read_timeout ||= @read_timeout
67
80
  ssl_ca_file ||= @ssl_ca_file
68
81
  ssl_ca_path ||= @ssl_ca_path
69
82
  ssl_cert_store ||= @ssl_cert_store
83
+ max_retry ||= @max_retry
84
+ retry_initial_delay ||= @retry_initial_delay
85
+ retry_max_delay ||= @retry_max_delay
70
86
 
71
87
  unless api_key ||= @api_key
72
88
  raise AuthenticationError.new('No API key provided. ' \
@@ -107,6 +123,8 @@ module Payjp
107
123
  :ssl_ca_file => ssl_ca_file, :ssl_ca_path => ssl_ca_path,
108
124
  :ssl_cert_store => ssl_cert_store)
109
125
 
126
+ retry_count = 1
127
+
110
128
  begin
111
129
  # $stderr.puts request_opts
112
130
 
@@ -122,6 +140,12 @@ module Payjp
122
140
  raise
123
141
  end
124
142
  rescue RestClient::ExceptionWithResponse => e
143
+ if e.http_code == 429 and retry_count <= max_retry then
144
+ sleep get_retry_delay(retry_count, retry_initial_delay, retry_max_delay)
145
+ retry_count += 1
146
+ retry
147
+ end
148
+
125
149
  if rcode = e.http_code and rbody = e.http_body
126
150
  handle_api_error(rcode, rbody)
127
151
  else
@@ -239,6 +263,8 @@ module Payjp
239
263
  raise authentication_error error, rcode, rbody, error_obj
240
264
  when 402
241
265
  raise card_error error, rcode, rbody, error_obj
266
+ when 429
267
+ raise api_error error, rcode, rbody, error_obj
242
268
  else
243
269
  raise api_error error, rcode, rbody, error_obj
244
270
  end
@@ -266,11 +292,12 @@ module Payjp
266
292
  api_base_url = @api_base unless api_base_url
267
293
  connection_message = "Please check your internet connection and try again. " \
268
294
  "If this problem persists, you should check Payjp's service status at " \
269
- "https://twitter.com/payjpstatus, or let us know at support@pay.jp."
295
+ "https://status.pay.jp or let us know at support@pay.jp."
270
296
 
271
297
  case e
272
298
  when RestClient::RequestTimeout
273
- message = "Could not connect to Payjp (#{api_base_url}). #{connection_message}"
299
+ message = "Timed out over #{@read_timeout} sec. " \
300
+ "Check if your request successed or not."
274
301
 
275
302
  when RestClient::ServerBrokeConnection
276
303
  message = "The connection to the server (#{api_base_url}) broke before the " \
@@ -278,8 +305,7 @@ module Payjp
278
305
 
279
306
  when SocketError
280
307
  message = "Unexpected error communicating when trying to connect to Payjp. " \
281
- "You may be seeing this message because your DNS is not working. " \
282
- "To check, try running 'host pay.jp' from the command line."
308
+ "Your DNS may not work. Check 'host api.pay.jp' from the command line."
283
309
 
284
310
  else
285
311
  message = "Unexpected error communicating with Payjp. " \
data/payjp.gemspec CHANGED
@@ -12,16 +12,19 @@ Gem::Specification.new do |s|
12
12
  s.homepage = 'https://pay.jp'
13
13
  s.license = 'MIT'
14
14
 
15
- s.add_dependency('rest-client', '~> 1.4')
16
- s.add_dependency('json', '~> 1.8.1')
15
+ s.add_dependency('rest-client', '~> 2.0')
17
16
 
18
- s.add_development_dependency('mocha', '~> 0.13.2')
19
- s.add_development_dependency('shoulda', '~> 3.4.0')
20
- s.add_development_dependency('test-unit')
21
- s.add_development_dependency('rake')
17
+ s.add_development_dependency('mocha', '~> 1.2.1')
18
+ s.add_development_dependency('activesupport', ['< 5.0', '~> 4.2.7'])
19
+ s.add_development_dependency('test-unit', '~> 3.2.2')
20
+ s.add_development_dependency('rake', '~> 11.3.0')
21
+ s.add_development_dependency('bundler', '>= 1.7.6')
22
22
 
23
23
  s.files = `git ls-files`.split("\n")
24
24
  s.test_files = `git ls-files -- test/*`.split("\n")
25
25
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
26
- s.require_paths = ['lib']
26
+ s.require_paths = ['lib']
27
+ s.metadata = {
28
+ "source_code_uri" => "https://github.com/payjp/payjp-ruby",
29
+ }
27
30
  end
@@ -411,6 +411,25 @@ module Payjp
411
411
 
412
412
  assert_equal true, rescued
413
413
  end
414
+
415
+ should "429s should raise a APIError of over capacity error code" do
416
+ response = test_response(test_over_capacity_error, 429)
417
+ @mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 429))
418
+
419
+ rescued = false
420
+ begin
421
+ Payjp::Customer.new("test_customer").refresh
422
+ assert false # shouldn't get here either
423
+ rescue Payjp::APIError => e # we don't use assert_raises because we want to examine e
424
+ rescued = true
425
+ assert e.is_a? Payjp::APIError
426
+ assert_equal(429, e.http_status)
427
+ assert_equal(true, !!e.http_body)
428
+ assert_equal("over_capacity", e.json_body[:error][:code])
429
+ end
430
+
431
+ assert_equal true, rescued
432
+ end
414
433
  end
415
434
 
416
435
  should 'save nothing if nothing changes' do
@@ -442,4 +461,120 @@ module Payjp
442
461
  end
443
462
  end
444
463
  end
464
+
465
+ class APIRequestorRetryTest < Test::Unit::TestCase
466
+
467
+ setup do
468
+ Payjp.max_retry = 0
469
+ Payjp.retry_initial_delay = 0.1
470
+ end
471
+
472
+ def mock_exceptions(error_codes, call_count)
473
+ exception_mock = nil
474
+ error_codes.with_index(1) { |code, id|
475
+ if id == 1
476
+ exception_mock = @mock.expects(:get).raises(RestClient::ExceptionWithResponse.new(test_response(test_api_error, code)))
477
+ else
478
+ exception_mock = exception_mock.then.raises(RestClient::ExceptionWithResponse.new(test_response(test_api_error, code)))
479
+ end
480
+ }
481
+ exception_mock.at_least(call_count)
482
+ end
483
+
484
+ context "checking retry" do
485
+ should "over capacity retry disabled" do
486
+ error_codes = [429, 599].to_enum
487
+ # returns 599 at 2nd try but max_retry 0 then retry disabled
488
+ mock_exceptions(error_codes, 1)
489
+ rescued = false
490
+
491
+ begin
492
+ Payjp::Charge.retrieve("test_charge")
493
+ rescue Payjp::APIError => e # we don't use assert_raises because we want to examine e
494
+ assert e.is_a? Payjp::APIError
495
+ assert_equal(429, e.http_status)
496
+ rescued = true
497
+ end
498
+ assert_equal true, rescued
499
+ end
500
+
501
+ should "no retry" do
502
+ Payjp.max_retry = 2
503
+ Payjp.retry_initial_delay = 0.1
504
+ error_codes = [599, 429, 429, 429].to_enum
505
+ # returns 599 at first try
506
+ mock_exceptions(error_codes, 1)
507
+ rescued = false
508
+
509
+ begin
510
+ Payjp::Charge.retrieve("test_charge")
511
+ rescue Payjp::APIError => e # we don't use assert_raises because we want to examine e
512
+ assert e.is_a? Payjp::APIError
513
+ assert_equal(599, e.http_status)
514
+ assert_equal(true, !!e.http_body)
515
+ rescued = true
516
+ end
517
+ assert_equal true, rescued
518
+ end
519
+
520
+ should "over capacity full retry" do
521
+ Payjp.max_retry = 2
522
+ Payjp.retry_initial_delay = 0.1
523
+ error_codes = [429, 429, 429, 429, 599].to_enum
524
+
525
+ # first try + 2 retries + unexpected 599
526
+ mock_exceptions(error_codes, 3)
527
+ rescued = false
528
+
529
+ begin
530
+ Payjp::Charge.retrieve("test_charge")
531
+ rescue Payjp::APIError => e # we don't use assert_raises because we want to examine e
532
+ assert e.is_a? Payjp::APIError
533
+ assert_equal(429, e.http_status)
534
+ rescued = true
535
+ end
536
+
537
+ assert_equal true, rescued
538
+ end
539
+
540
+ should "over capacity halfway of retries" do
541
+ Payjp.max_retry = 5
542
+ Payjp.retry_initial_delay = 0.1
543
+
544
+ error_codes = [429, 599, 429, 429, 429].to_enum
545
+ rescued = false
546
+
547
+ # returns not 429 status at 2nd try
548
+ mock_exceptions(error_codes, 2)
549
+ begin
550
+ Payjp::Charge.retrieve("test_charge")
551
+ rescue Payjp::APIError => e # we don't use assert_raises because we want to examine e
552
+ assert e.is_a? Payjp::APIError
553
+ assert_equal(599, e.http_status)
554
+ rescued = true
555
+ end
556
+
557
+ assert_equal true, rescued
558
+ end
559
+ end
560
+
561
+ context "retry interval" do
562
+ should "retry initial delay" do
563
+ retry_initial_delay = 2
564
+ retry_max_delay = 32
565
+
566
+ assert_equal(true, Payjp.get_retry_delay(0, retry_initial_delay, retry_max_delay).between?(1, 2))
567
+ assert_equal(true, Payjp.get_retry_delay(1, retry_initial_delay, retry_max_delay).between?(2, 4))
568
+ assert_equal(true, Payjp.get_retry_delay(2, retry_initial_delay, retry_max_delay).between?(4, 8))
569
+ # cap
570
+ assert_equal(true, Payjp.get_retry_delay(4, retry_initial_delay, retry_max_delay).between?(16, 32))
571
+ assert_equal(true, Payjp.get_retry_delay(10, retry_initial_delay, retry_max_delay).between?(16, 32))
572
+ end
573
+ end
574
+
575
+ teardown do
576
+ Payjp.max_retry = 0
577
+ Payjp.retry_initial_delay = 0.1
578
+ end
579
+ end
445
580
  end
@@ -79,5 +79,17 @@ module Payjp
79
79
  })
80
80
  assert c.paid
81
81
  end
82
+
83
+ should "charges should be reauthable" do
84
+ now = Time.now.localtime("+09:00")
85
+ expired_at = now + 60 * 60 * 24 * 6
86
+ expired_at = Time.new(expired_at.year, expired_at.mon, expired_at.day, 23, 59, 59, now.utc_offset)
87
+ @mock.expects(:get).never
88
+ @mock.expects(:post).once.returns(test_response({ :id => "ch_test_charge", :expired_at => expired_at.to_i }))
89
+
90
+ c = Payjp::Charge.new("test_charge")
91
+ c.reauth
92
+ assert_equal expired_at.to_i, c.expired_at
93
+ end
82
94
  end
83
95
  end
@@ -30,5 +30,17 @@ module Payjp
30
30
  assert_raise { Payjp::Util.normalize_opts(nil) }
31
31
  assert_raise { Payjp::Util.normalize_opts(:api_key => nil) }
32
32
  end
33
+
34
+ should "url_encode should escape only UNRESERVED characters" do
35
+ unreserved = %q|!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~|
36
+ (0..255).each do |c|
37
+ s = [c].pack("C")
38
+ if unreserved.include?(s)
39
+ assert_equal(s, Payjp::Util.url_encode(s))
40
+ else
41
+ assert_equal("%"+sprintf("%02X", c), Payjp::Util.url_encode(s))
42
+ end
43
+ end
44
+ end
33
45
  end
34
46
  end
data/test/test_data.rb CHANGED
@@ -287,5 +287,14 @@ module Payjp
287
287
  }
288
288
  }
289
289
  end
290
+
291
+ def test_over_capacity_error
292
+ {
293
+ :error => {
294
+ :code => "over_capacity",
295
+ :type => "api_error"
296
+ }
297
+ }
298
+ end
290
299
  end
291
300
  end
data/test/test_helper.rb CHANGED
@@ -2,7 +2,6 @@ require 'payjp'
2
2
  require 'test/unit'
3
3
  require 'mocha/setup'
4
4
  require 'stringio'
5
- require 'shoulda'
6
5
  require File.expand_path('../test_data', __FILE__)
7
6
 
8
7
  # monkeypatch request methods
@@ -11,6 +10,7 @@ module Payjp
11
10
 
12
11
  class << self
13
12
  attr_writer :mock_rest_client
13
+ remove_method :execute_request
14
14
  end
15
15
 
16
16
  def self.execute_request(opts)
@@ -28,6 +28,11 @@ class Test::Unit::TestCase
28
28
  include Payjp::TestData
29
29
  include Mocha
30
30
 
31
+ class << self
32
+ alias_method :context, :sub_test_case
33
+ alias_method :should, :test
34
+ end
35
+
31
36
  def encode_credentials(user_name)
32
37
  "Basic #{Base64.strict_encode64("#{user_name}:")}"
33
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,84 +16,90 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.4'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: json
28
+ name: mocha
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.1
34
- type: :runtime
33
+ version: 1.2.1
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.1
40
+ version: 1.2.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: mocha
42
+ name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
45
48
  - - "~>"
46
49
  - !ruby/object:Gem::Version
47
- version: 0.13.2
50
+ version: 4.2.7
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
55
+ - - "<"
56
+ - !ruby/object:Gem::Version
57
+ version: '5.0'
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: 0.13.2
60
+ version: 4.2.7
55
61
  - !ruby/object:Gem::Dependency
56
- name: shoulda
62
+ name: test-unit
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: 3.4.0
67
+ version: 3.2.2
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: 3.4.0
74
+ version: 3.2.2
69
75
  - !ruby/object:Gem::Dependency
70
- name: test-unit
76
+ name: rake
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - ">="
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0'
81
+ version: 11.3.0
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - ">="
86
+ - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0'
88
+ version: 11.3.0
83
89
  - !ruby/object:Gem::Dependency
84
- name: rake
90
+ name: bundler
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - ">="
88
94
  - !ruby/object:Gem::Version
89
- version: '0'
95
+ version: 1.7.6
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - ">="
95
101
  - !ruby/object:Gem::Version
96
- version: '0'
102
+ version: 1.7.6
97
103
  description: PAY.JP makes it way easier and less expensive to accept payments.
98
104
  email:
99
105
  - support@pay.jp
@@ -101,20 +107,16 @@ executables: []
101
107
  extensions: []
102
108
  extra_rdoc_files: []
103
109
  files:
110
+ - ".github/workflows/test.yml"
104
111
  - ".gitignore"
105
112
  - ".rubocop.yml"
106
113
  - ".rubocop_todo.yml"
107
- - ".travis.yml"
108
114
  - CONTRIBUTORS
109
115
  - Gemfile
110
116
  - History.txt
111
117
  - LICENSE
112
- - README.rdoc
118
+ - README.md
113
119
  - Rakefile
114
- - VERSION
115
- - gemfiles/default-with-activesupport.gemfile
116
- - gemfiles/json.gemfile
117
- - gemfiles/yajl.gemfile
118
120
  - lib/payjp.rb
119
121
  - lib/payjp/account.rb
120
122
  - lib/payjp/api_operations/create.rb
@@ -161,8 +163,9 @@ files:
161
163
  homepage: https://pay.jp
162
164
  licenses:
163
165
  - MIT
164
- metadata: {}
165
- post_install_message:
166
+ metadata:
167
+ source_code_uri: https://github.com/payjp/payjp-ruby
168
+ post_install_message:
166
169
  rdoc_options: []
167
170
  require_paths:
168
171
  - lib
@@ -177,9 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
180
  - !ruby/object:Gem::Version
178
181
  version: '0'
179
182
  requirements: []
180
- rubyforge_project:
181
- rubygems_version: 2.4.8
182
- signing_key:
183
+ rubygems_version: 3.1.2
184
+ signing_key:
183
185
  specification_version: 4
184
186
  summary: Ruby bindings for the Payjp API
185
187
  test_files:
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 1.9.2
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - jruby-19mode
10
-
11
- gemfile:
12
- - gemfiles/default-with-activesupport.gemfile
13
- - gemfiles/json.gemfile
14
- - gemfiles/yajl.gemfile
15
-
16
- matrix:
17
- exclude:
18
- - rvm: jruby-19mode
19
- gemfile: gemfiles/yajl.gemfile
20
-
21
- sudo: false
data/README.rdoc DELETED
@@ -1,37 +0,0 @@
1
- = PAY.JP for Ruby
2
-
3
- == Documentation
4
-
5
- {PAY.JP API Docs}[https://pay.jp/docs/api/]
6
-
7
- == Installation
8
-
9
- You don't need this source code unless you want to modify the gem. If
10
- you just want to use the Payjp Ruby bindings, you should run:
11
-
12
- gem install payjp
13
-
14
- If you want to build the gem from source:
15
-
16
- gem build payjp.gemspec
17
-
18
- == Requirements
19
-
20
- * Ruby 1.9.3 or above.
21
-
22
- * rest-client, json
23
-
24
- == Bundler
25
-
26
- If you are installing via bundler, you should be sure to use the https
27
- rubygems source in your Gemfile, as any gems fetched over http could potentially be
28
- compromised in transit and alter the code of gems fetched securely over https:
29
-
30
- source 'https://rubygems.org'
31
-
32
- gem 'rails'
33
- gem 'payjp'
34
-
35
- == Development
36
-
37
- Test cases can be run with: `bundle exec rake test`
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.4
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec :path => File.join(File.dirname(__FILE__), "..")
3
-
4
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
5
- gem 'i18n', '< 0.7'
6
- gem 'rest-client', '~> 1.6.8'
7
- gem 'activesupport', '~> 3.2'
8
- else
9
- gem 'activesupport'
10
- end
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec :path => File.join(File.dirname(__FILE__), "..")
3
-
4
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
5
- gem 'i18n', '< 0.7'
6
- gem 'rest-client', '~> 1.6.8'
7
- gem 'activesupport', '~> 3.2'
8
- else
9
- gem 'activesupport'
10
- end
11
-
12
- gem 'json'
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec :path => File.join(File.dirname(__FILE__), "..")
3
-
4
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
5
- gem 'i18n', '< 0.7'
6
- gem 'rest-client', '~> 1.6.8'
7
- gem 'activesupport', '~> 3.2'
8
- else
9
- gem 'activesupport'
10
- end
11
-
12
- gem 'yajl-ruby'