payjp_mock 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3a8a7052de70b5670602d1769638f73427f18a2
4
- data.tar.gz: 27ec5981df2d01b0a66664ae1376ec915326d9ff
3
+ metadata.gz: 781df7ed343c3d3d363d3c94cb1f6c27946b93d2
4
+ data.tar.gz: b90ae66c681c1b4650d1668f8d89c54da3cdd608
5
5
  SHA512:
6
- metadata.gz: b8cd9c8ace263a9a886a244dfb154d1d53d518fd975d7fd41feb2f8f5953bc8fb148e6e500c059fb83cb7b52be49a081c6b37f511e4a3cac02f7bb2899a8a2e8
7
- data.tar.gz: 75c9e3a067e7c301dd128ee14137a2f755e4d54ce84e0e8c49578c80759b9218e16ab2d2c33876f2bf6cc50b0193a2d02ca4c4783e93b5904f3a8996e1e949de
6
+ metadata.gz: c4213de616fc6ba5d3b6420171700e4c9426011921720f64b472de97843213794b5c6f2d82253d39ef91e8c6abb16fc3dd21d32eb48b8d77174d6a7b61f5e6c2
7
+ data.tar.gz: fbd868f91ab569b0fc8dc168ede3eef25b494fbcf42b9e132a0c1a2d9c474d7d7df5a03bc36648fd4f318c54b7726ba4e41cf2f123ff25f39e88b9a41e25b618
data/README.md CHANGED
@@ -40,7 +40,7 @@ specify do
40
40
  payjp_stub(:charges, :create)
41
41
  Payjp::Charge.create(amount: 3500, card: 'tok_xxxxx', currency: 'jpy')
42
42
 
43
- # Stubbing nested resources operation such as customer's card list retrival
43
+ # Stubbing nested resource operations such as customer's card list retrival
44
44
  payjp_stub(:customer, :retrival)
45
45
  customer = Payjp::Customer.retrieve('cus_xxxxx')
46
46
 
data/lib/payjp_mock.rb CHANGED
@@ -2,9 +2,10 @@ module PayjpMock
2
2
  end
3
3
 
4
4
  require 'payjp_mock/ext'
5
+ require 'payjp_mock/util'
6
+
5
7
  require 'payjp_mock/request'
6
8
  require 'payjp_mock/request_builder'
7
9
  require 'payjp_mock/response'
8
- require 'payjp_mock/util'
9
10
  require 'payjp_mock/webmock_wrapper'
10
11
  require 'payjp_mock/version'
@@ -1,2 +1,5 @@
1
+ module PayjpMock::Ext
2
+ end
3
+
1
4
  require 'payjp_mock/ext/hash'
2
5
  require 'payjp_mock/ext/integer'
@@ -1,7 +1,9 @@
1
- module HashExtension
2
- def symbolize_keys
3
- each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
1
+ module PayjpMock::Ext
2
+ module Hash
3
+ refine ::Hash do
4
+ def symbolize_keys
5
+ each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
6
+ end
7
+ end
4
8
  end
5
9
  end
6
-
7
- Hash.send(:include, HashExtension)
@@ -1,8 +1,10 @@
1
- module IntegerExtension
2
- def days
3
- self * 24 * 60 * 60
1
+ module PayjpMock::Ext
2
+ module Integer
3
+ refine ::Integer do
4
+ def days
5
+ self * 24 * 60 * 60
6
+ end
7
+ alias :day :days
8
+ end
4
9
  end
5
- alias :day :days
6
10
  end
7
-
8
- Integer.send(:include, IntegerExtension)
@@ -1,11 +1,7 @@
1
- require 'payjp_mock/ext/hash'
2
- require 'payjp_mock/request'
3
- require 'payjp_mock/response'
4
- require 'payjp_mock/util'
5
-
6
1
  module PayjpMock
7
2
  class RequestBuilder
8
3
  include Util
4
+ using Ext::Hash
9
5
 
10
6
  def initialize(resource, operation, error)
11
7
  @resource = resource.is_a?(Hash) ? resource.symbolize_keys : resource.to_sym
@@ -1,9 +1,7 @@
1
- require 'payjp_mock/ext'
2
- require 'payjp_mock/util'
3
-
4
1
  module PayjpMock
5
2
  class Response::Resource::Base < Response::Base
6
3
  include Util
4
+ using Ext::Hash
7
5
 
8
6
  def initialize(attributes = {})
9
7
  @attributes = default_attributes.merge(attributes.symbolize_keys)
@@ -1,5 +1,7 @@
1
1
  module PayjpMock::Response::Resource
2
2
  class Subscription < Base
3
+ using PayjpMock::Ext::Integer
4
+
3
5
  PREFIX = 'sub'.freeze
4
6
  OBJECT = 'subscription'.freeze
5
7
 
@@ -1,5 +1,7 @@
1
1
  module PayjpMock::Response::Resource
2
2
  class Transfer < Base
3
+ using PayjpMock::Ext::Integer
4
+
3
5
  PREFIX = 'tr'.freeze
4
6
  OBJECT = 'transfer'.freeze
5
7
 
@@ -1,3 +1,3 @@
1
1
  module PayjpMock
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'
3
3
  end
@@ -1,5 +1,3 @@
1
- require 'payjp_mock/request_builder'
2
-
3
1
  module PayjpMock
4
2
  module WebMockWrapper
5
3
  def payjp_stub(resource, operation, error: nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjp_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kirikiriyamama