omise 0.5.0 → 0.5.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: fb0747d2916db26b8867f729d2fc45ec8c0ae298
4
- data.tar.gz: 6f32be4761236faaca1495948d8bd4abe33581c0
3
+ metadata.gz: 26de59160d14b03572bf1697765e0055033bde51
4
+ data.tar.gz: df763a37a7abeb4f5b8dcf547e6a2042370437ab
5
5
  SHA512:
6
- metadata.gz: 5f0cdda6e658f79be9a7056e2f49d5a634cb8cb74664b2e54753bce1d36ff8c6e3120e5c4f69536dac1ed4fb9d0124516e2c8ba838a50a0351beaa16ea1458d6
7
- data.tar.gz: 6fbba84db39bfe3efbf8085b82c2c32931d913745b972299e8d4560a86abbab9f02c82cab48e70f4dfbaa878e18274b0c58e88bf1254d1a9069782c6981eeed3
6
+ metadata.gz: de7f8dab27de2aacf55c78f55d067c8eb31eec125b05db1a21c150b7229a459f347342a59c23c5b8ac89668a8a47770f24ddf4ed5da8ed071338b4448b347512
7
+ data.tar.gz: 3f48a5677710a2126aa4af36d38891a2488cc10ba673558c1696f73b5be9a8830130a1d31057ebe3aa3bacfbce6d2004ee02d81b96369df27b1a1e43df30c724
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  An [unreleased] version is not available on rubygems and is subject to changes and must not be considered final. Elements of unreleased list may be edited or removed at any time.
4
4
 
5
+ ## [unreleased]
6
+
7
+ - [Added] Support to log HTTP requests and responses.
8
+ - [Added] Rename keys with better names while supporting old methods
9
+ - [Fix] Avoid circular require warnings when running tests
10
+
5
11
  ## [0.5.0] 2016-11-26
6
12
 
7
13
  - [Added] Add search object and filtering api
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  ## Installation
9
9
 
10
- Installing via rubgems:
10
+ Installing via rubygems:
11
11
 
12
12
  ```ruby
13
13
  gem 'omise'
@@ -21,7 +21,7 @@ gem 'omise', github: 'omise/omise-ruby'
21
21
 
22
22
  ## Requirements
23
23
 
24
- Requires ruby 1.9.2 or above, the rest-client and json gem.
24
+ Requires ruby 1.9.2 or above, the rest-client and json gems.
25
25
 
26
26
  ## Configuration
27
27
 
@@ -34,20 +34,20 @@ Omise.api_key = "skey_test_xxxxxxxxxxxxxxxxxxx"
34
34
  If you need to use the Token API you also need to set your public key:
35
35
 
36
36
  ```ruby
37
- Omise.vault_key = "pkey_test_xxxxxxxxxxxxxxxxxxx"
37
+ Omise.public_api_key = "pkey_test_xxxxxxxxxxxxxxxxxxx"
38
38
  ```
39
39
 
40
40
  With this set you'll be able to retrieve tokens or create new ones.
41
41
 
42
- However we recommend using [Omise.js](https://gitub.com/omise/omise.js) to
43
- create tokens. When creating a token server side you'll need card data
42
+ However we recommend using [Omise.js](https://github.com/omise/omise.js) to
43
+ [collect cards](https://www.omise.co/collecting-card-information). When creating a token server side you'll need card data
44
44
  transiting to and from your server and this requires that your organization be
45
45
  PCI compliant.
46
46
 
47
47
  ### API version
48
48
 
49
49
  In case you want to enforce API version the application use, you can specify it
50
- by setting the api_version. The version specified by this settings will override
50
+ by setting the `api_version`. The version specified by this settings will override
51
51
  the version setting in your account. This is useful if you have multiple
52
52
  environments with different API versions (e.g. development on the latest but
53
53
  production on the older version).
@@ -60,6 +60,18 @@ Omise.api_version = "2014-07-27"
60
60
  It is highly recommended to set this version to the current version
61
61
  you're using.
62
62
 
63
+ ### Logging
64
+
65
+ To enable log you can set `Omise.logger` with a Ruby logger. All HTTP requests and responses will be logged.
66
+
67
+ To disable log, just configure `Omise.logger` to `nil`. Default is disabled.
68
+
69
+ An example configuring Rails logger:
70
+
71
+ ```ruby
72
+ Omise.logger = Rails.logger
73
+ ```
74
+
63
75
  ## Quick Start
64
76
 
65
77
  After you have implemented [Omise.js](https://gitub.com/omise/omise.js) on your
data/bin/console CHANGED
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  require "omise"
5
5
 
6
- Omise.api_key = ENV["OMISE_API_KEY"]
6
+ Omise.secret_api_key = ENV["OMISE_API_KEY"]
7
7
 
8
8
  require "pry"
9
9
  Pry.start
data/lib/omise/all.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "omise/account"
2
2
  require "omise/balance"
3
+ require "omise/bank_account"
3
4
  require "omise/card"
4
5
  require "omise/charge"
5
6
  require "omise/customer"
@@ -1,14 +1,20 @@
1
1
  require "omise/list"
2
- require "omise/card"
3
- require "omise/token"
4
2
 
5
3
  module Omise
6
4
  class CardList < List
7
5
  def retrieve(id, attributes = {})
6
+ if !defined?(Card)
7
+ require "omise/card"
8
+ end
9
+
8
10
  Card.new self.class.resource(location(id), attributes).get(attributes)
9
11
  end
10
12
 
11
13
  def create(attributes = {})
14
+ if !defined?(Token)
15
+ require "omise/token"
16
+ end
17
+
12
18
  token = Token.create(card: attributes)
13
19
  parent.update(card: token.id)
14
20
  retrieve(token.card.id)
data/lib/omise/charge.rb CHANGED
@@ -1,10 +1,7 @@
1
1
  require "omise/object"
2
2
  require "omise/list"
3
- require "omise/customer"
4
- require "omise/dispute"
5
3
  require "omise/refund_list"
6
4
  require "omise/search_scope"
7
- require "omise/transaction"
8
5
 
9
6
  module Omise
10
7
  class Charge < OmiseObject
@@ -43,14 +40,26 @@ module Omise
43
40
  end
44
41
 
45
42
  def customer(options = {})
43
+ if !defined?(Customer)
44
+ require "omise/customer"
45
+ end
46
+
46
47
  expand_attribute Customer, "customer", options
47
48
  end
48
49
 
49
50
  def dispute(options = {})
51
+ if !defined?(Dispute)
52
+ require "omise/dispute"
53
+ end
54
+
50
55
  expand_attribute Dispute, "dispute", options
51
56
  end
52
57
 
53
58
  def transaction(options = {})
59
+ if !defined?(Transaction)
60
+ require "omise/transaction"
61
+ end
62
+
54
63
  expand_attribute Transaction, "transaction", options
55
64
  end
56
65
 
data/lib/omise/config.rb CHANGED
@@ -1,35 +1,58 @@
1
+ require "omise/http_logger"
1
2
  require "omise/resource"
2
3
 
3
4
  module Omise
5
+ LIB_PATH = File.expand_path("../../", __FILE__)
6
+
4
7
  class << self
5
- attr_writer :api_key, :vault_key
6
8
  attr_accessor :api_url, :vault_url, :api_version, :resource
7
9
 
8
- def api_key
9
- get_key :api
10
+ attr_writer :secret_api_key, :public_api_key
11
+
12
+ def secret_api_key
13
+ get_key :secret_api_key
10
14
  end
11
15
 
12
- def vault_key
13
- get_key :vault
16
+ def public_api_key
17
+ get_key :public_api_key
18
+ end
19
+
20
+ # Backward compatibility with old API Keys naming conventions
21
+ #
22
+ # Will be removed in 1.0
23
+ alias_method :api_key, :secret_api_key
24
+ alias_method :api_key=, :secret_api_key=
25
+ alias_method :vault_key, :public_api_key
26
+ alias_method :vault_key=, :public_api_key=
27
+
28
+ def logger=(logger)
29
+ @http_logger = Omise::HTTPLogger.new(logger)
30
+ end
31
+
32
+ def http_logger
33
+ @http_logger ||= Omise::HTTPLogger.new
14
34
  end
15
35
 
16
36
  def test!
17
- require "omise/testing/resource"
37
+ if !defined?(Omise::Testing::Resource)
38
+ require "omise/testing/resource"
39
+ end
40
+
18
41
  self.resource = Omise::Testing::Resource
19
42
  end
20
43
 
21
44
  private
22
45
 
23
46
  def get_key(name)
24
- if key = instance_variable_get("@#{name}_key")
47
+ if key = instance_variable_get("@#{name}")
25
48
  key
26
49
  else
27
- raise "Set Omise.#{name}_key to use this feature"
50
+ raise "Set Omise.#{name} to use this feature"
28
51
  end
29
52
  end
30
53
  end
31
54
 
32
- self.api_url = "https://api.omise.co"
55
+ self.api_url = "https://api.omise.co"
33
56
  self.vault_url = "https://vault.omise.co"
34
- self.resource = Resource
57
+ self.resource = Resource
35
58
  end
@@ -1,7 +1,6 @@
1
1
  require "omise/object"
2
- require "omise/card_list"
3
- require "omise/charge"
4
2
  require "omise/list"
3
+ require "omise/card_list"
5
4
  require "omise/search_scope"
6
5
 
7
6
  module Omise
@@ -37,6 +36,10 @@ module Omise
37
36
  end
38
37
 
39
38
  def charge(attributes = {})
39
+ if !defined?(Charge)
40
+ require "omise/charge"
41
+ end
42
+
40
43
  Charge.create(attributes.merge(customer: id))
41
44
  end
42
45
 
data/lib/omise/dispute.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "omise/object"
2
- require "omise/charge"
3
- require "omise/document_list"
4
2
  require "omise/list"
3
+ require "omise/document_list"
5
4
  require "omise/search_scope"
6
5
 
7
6
  module Omise
@@ -30,6 +29,10 @@ module Omise
30
29
  end
31
30
 
32
31
  def charge(options = {})
32
+ if !defined?(Charge)
33
+ require "omise/charge"
34
+ end
35
+
33
36
  expand_attribute Charge, "charge", options
34
37
  end
35
38
 
@@ -1,13 +1,20 @@
1
- require "omise/document"
2
1
  require "omise/list"
3
2
 
4
3
  module Omise
5
4
  class DocumentList < List
6
5
  def retrieve(id, attributes = {})
6
+ if !defined?(Document)
7
+ require "omise/document"
8
+ end
9
+
7
10
  Document.new self.class.resource(location(id), attributes).get(attributes)
8
11
  end
9
12
 
10
13
  def upload(file)
14
+ if !defined?(Document)
15
+ require "omise/document"
16
+ end
17
+
11
18
  attributes = { file: file }
12
19
  Document.new self.class.resource(location, attributes).post(attributes)
13
20
  end
@@ -0,0 +1,59 @@
1
+ module Omise
2
+ class HTTPLogger
3
+ LABEL = "[Omise]".freeze
4
+
5
+ def initialize(logger = nil)
6
+ @logger = logger
7
+ end
8
+
9
+ attr_reader :logger
10
+
11
+ def log_request(request)
12
+ info(format_request(request))
13
+ end
14
+
15
+ def log_response(response)
16
+ info(format_response(response))
17
+ end
18
+
19
+ private
20
+
21
+ def info(message)
22
+ return unless @logger
23
+
24
+ @logger.info(message)
25
+ end
26
+
27
+ def format_request(request)
28
+ StringIO.open do |s|
29
+ s.puts("#{LABEL} Request: #{request.method.to_s.upcase} #{request.url}")
30
+ s.puts(format_headers(request.processed_headers))
31
+ s.puts
32
+ s.puts(format_payload(request.args[:payload])) if request.args[:payload]
33
+
34
+ s.string
35
+ end
36
+ end
37
+
38
+ def format_response(response)
39
+ net_http = response.net_http_res
40
+
41
+ StringIO.open do |s|
42
+ s.puts("#{LABEL} Response: HTTP/#{net_http.http_version} #{net_http.code} #{net_http.message}")
43
+ s.puts(format_headers(net_http.each_capitalized))
44
+ s.puts
45
+ s.puts(response.body)
46
+
47
+ s.string
48
+ end
49
+ end
50
+
51
+ def format_headers(headers)
52
+ headers.map { |name, value| "#{name}: #{value}" }.join("\n")
53
+ end
54
+
55
+ def format_payload(payload)
56
+ payload.map { |key, value| "#{key}=#{value}" }.join("&")
57
+ end
58
+ end
59
+ end
data/lib/omise/link.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "omise/object"
2
+ require "omise/list"
2
3
  require "omise/charge_list"
4
+ require "omise/search_scope"
3
5
 
4
6
  module Omise
5
7
  class Link < OmiseObject
data/lib/omise/object.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "omise/config"
2
2
  require "omise/attributes"
3
- require "omise/resource"
4
3
 
5
4
  module Omise
6
5
  class OmiseObject
@@ -43,7 +42,7 @@ module Omise
43
42
  end
44
43
 
45
44
  def resource_key
46
- Omise.api_key
45
+ Omise.secret_api_key
47
46
  end
48
47
  end
49
48
 
@@ -1,5 +1,5 @@
1
1
  require "omise/object"
2
- require "omise/bank_account"
2
+ require "omise/list"
3
3
  require "omise/search_scope"
4
4
 
5
5
  module Omise
@@ -35,6 +35,10 @@ module Omise
35
35
  end
36
36
 
37
37
  def bank_account
38
+ if !defined?(BankAccount)
39
+ require "omise/bank_account"
40
+ end
41
+
38
42
  expand_attribute BankAccount, "bank_account"
39
43
  end
40
44
  end
data/lib/omise/refund.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "omise/object"
2
- require "omise/charge"
3
- require "omise/transaction"
2
+ require "omise/search_scope"
4
3
 
5
4
  module Omise
6
5
  class Refund < OmiseObject
@@ -15,10 +14,18 @@ module Omise
15
14
  end
16
15
 
17
16
  def charge(options = {})
17
+ if !defined?(Charge)
18
+ require "omise/charge"
19
+ end
20
+
18
21
  expand_attribute Charge, "charge", options
19
22
  end
20
23
 
21
24
  def transaction(options = {})
25
+ if !defined?(Transaction)
26
+ require "omise/transaction"
27
+ end
28
+
22
29
  expand_attribute Transaction, "transaction", options
23
30
  end
24
31
  end
@@ -1,5 +1,4 @@
1
1
  require "omise/list"
2
- require "omise/refund"
3
2
 
4
3
  module Omise
5
4
  class RefundList < List
@@ -1,11 +1,8 @@
1
1
  require "uri"
2
- require "json"
3
2
  require "openssl"
4
3
  require "rest-client"
5
4
 
6
5
  require "omise/util"
7
- require "omise/config"
8
- require "omise/error"
9
6
  require "omise/version"
10
7
 
11
8
  module Omise
@@ -31,19 +28,31 @@ module Omise
31
28
  set_resource
32
29
  end
33
30
 
34
- @resource.get { |r| Omise::Util.load_response(r) }
31
+ @resource.get do |response, request|
32
+ log(request, response)
33
+ Omise::Util.load_response(response)
34
+ end
35
35
  end
36
36
 
37
37
  def patch(attributes = {})
38
- @resource.patch(attributes) { |r| Omise::Util.load_response(r) }
38
+ @resource.patch(attributes) do |response, request|
39
+ log(request, response)
40
+ Omise::Util.load_response(response)
41
+ end
39
42
  end
40
43
 
41
44
  def post(attributes = {})
42
- @resource.post(attributes) { |r| Omise::Util.load_response(r) }
45
+ @resource.post(attributes) do |response, request|
46
+ log(request, response)
47
+ Omise::Util.load_response(response)
48
+ end
43
49
  end
44
50
 
45
51
  def delete
46
- @resource.delete { |r| Omise::Util.load_response(r) }
52
+ @resource.delete do |response, request|
53
+ log(request, response)
54
+ Omise::Util.load_response(response)
55
+ end
47
56
  end
48
57
 
49
58
  private
@@ -57,6 +66,11 @@ module Omise
57
66
  })
58
67
  end
59
68
 
69
+ def log(request, response)
70
+ Omise.http_logger.log_request(request)
71
+ Omise.http_logger.log_response(response)
72
+ end
73
+
60
74
  def prepare_uri(url, path)
61
75
  URI.parse(url).tap do |uri|
62
76
  path = URI.parse(path)
@@ -1,7 +1,6 @@
1
1
  require "omise/object"
2
2
  require "omise/bank_account"
3
- require "omise/list"
4
- require "omise/recipient"
3
+ require "omise/search_scope"
5
4
 
6
5
  module Omise
7
6
  class Transfer < OmiseObject
@@ -36,10 +35,18 @@ module Omise
36
35
  end
37
36
 
38
37
  def recipient(options = {})
38
+ if !defined?(Recipient)
39
+ require "omise/recipient"
40
+ end
41
+
39
42
  expand_attribute Recipient, "recipient", options
40
43
  end
41
44
 
42
45
  def bank_account
46
+ if !defined?(BankAccount)
47
+ require "omise/bank_account"
48
+ end
49
+
43
50
  expand_attribute BankAccount, "bank_account"
44
51
  end
45
52
  end
data/lib/omise/util.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "cgi"
2
2
  require "json"
3
3
 
4
- require "omise/object"
5
4
  require "omise/error"
6
5
 
7
6
  module Omise
data/lib/omise/vault.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "omise/config"
2
-
3
1
  module Omise
4
2
  module Vault
5
3
  private
@@ -9,7 +7,7 @@ module Omise
9
7
  end
10
8
 
11
9
  def resource_key
12
- Omise.vault_key
10
+ Omise.public_api_key
13
11
  end
14
12
  end
15
13
  end
data/lib/omise/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Omise
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
data/lib/omise.rb CHANGED
@@ -1,6 +1,6 @@
1
+ require "omise/config"
1
2
  require "omise/all"
2
3
  require "omise/version"
3
4
 
4
5
  module Omise
5
- LIB_PATH = File.expand_path("../", __FILE__)
6
6
  end
data/omise.gemspec CHANGED
@@ -17,11 +17,11 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "rest-client", "~> 1.8.0"
21
- spec.add_dependency "json", "~> 1.8.1"
20
+ spec.add_dependency "rest-client", ">= 2.0"
21
+ spec.add_dependency "json", ">= 1.8"
22
22
 
23
23
  spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "pry"
26
- spec.add_development_dependency "minitest", "~> 5.4.2"
26
+ spec.add_development_dependency "minitest", ">= 5.4"
27
27
  end
@@ -12,6 +12,15 @@ class TestCharge < Omise::Test
12
12
  assert_equal "chrg_test_4yq7duw15p9hdrjp8oq", charge.id
13
13
  end
14
14
 
15
+ def test_that_we_can_create_a_charge_even_if_api_key_is_nil
16
+ without_keys do
17
+ charge = Omise::Charge.create(key: "skey_test_4yq6tct0lblmed2yp5t")
18
+
19
+ assert_instance_of Omise::Charge, charge
20
+ assert_equal "chrg_test_4yq7duw15p9hdrjp8oq", charge.id
21
+ end
22
+ end
23
+
15
24
  def test_that_we_can_retrieve_a_charge
16
25
  assert_instance_of Omise::Charge, @charge
17
26
  assert_equal "chrg_test_4yq7duw15p9hdrjp8oq", @charge.id
@@ -0,0 +1,24 @@
1
+ require "support"
2
+
3
+ class TestConfig < Omise::Test
4
+ def test_that_default_values_are_set
5
+ assert_equal "https://api.omise.co", Omise.api_url
6
+ assert_equal "https://vault.omise.co", Omise.vault_url
7
+ end
8
+
9
+ def test_that_default_http_logger_is_set
10
+ assert_instance_of Omise::HTTPLogger, Omise.http_logger
11
+ assert_nil Omise.http_logger.logger
12
+ end
13
+
14
+ def test_that_we_can_set_a_logger
15
+ logger = Logger.new(STDOUT)
16
+ Omise.logger = logger
17
+
18
+ assert_same logger, Omise.http_logger.logger
19
+ end
20
+
21
+ def teardown
22
+ Omise.logger = nil
23
+ end
24
+ end
@@ -0,0 +1,69 @@
1
+ require "support"
2
+
3
+ class TestHTTPLogger < Omise::Test
4
+ def test_we_can_initialize_a_logger_with_default_log
5
+ http_logger = Omise::HTTPLogger.new
6
+
7
+ assert_instance_of Omise::HTTPLogger, http_logger
8
+ assert_nil http_logger.logger
9
+ end
10
+
11
+ def test_we_can_initialize_a_logger_setting_a_log
12
+ logger = Logger.new(STDOUT)
13
+ http_logger = Omise::HTTPLogger.new(logger)
14
+
15
+ assert_instance_of Omise::HTTPLogger, http_logger
16
+ assert_same logger, http_logger.logger
17
+ end
18
+
19
+ def setup
20
+ @log_mock = MiniTest::Mock.new
21
+ end
22
+
23
+ def test_we_can_log_an_http_request
24
+ request = Struct.new(
25
+ :method,
26
+ :url,
27
+ :processed_headers,
28
+ :args
29
+ ).new(
30
+ :post,
31
+ "http://api.omise.co/path",
32
+ { "Header" => "value" },
33
+ { payload: { var1: "value1", var2: "value2" } },
34
+ )
35
+ expected_log_message = "[Omise] Request: POST http://api.omise.co/path\nHeader: value\n\nvar1=value1&var2=value2\n"
36
+ @log_mock.expect(:info, nil, [expected_log_message])
37
+
38
+ Omise::HTTPLogger.new(@log_mock).log_request(request)
39
+
40
+ assert @log_mock.verify
41
+ end
42
+
43
+ def test_we_can_log_an_http_response
44
+ net_http = Struct.new(
45
+ :http_version,
46
+ :code,
47
+ :message,
48
+ :each_capitalized
49
+ ).new(
50
+ "1.1",
51
+ 200,
52
+ "OK",
53
+ [["Header", "value"]]
54
+ )
55
+ response = Struct.new(
56
+ :net_http_res,
57
+ :body
58
+ ).new(
59
+ net_http,
60
+ "Work my body over"
61
+ )
62
+ expected_log_message = "[Omise] Response: HTTP/1.1 200 OK\nHeader: value\n\nWork my body over\n"
63
+ @log_mock.expect(:info, nil, [expected_log_message])
64
+
65
+ Omise::HTTPLogger.new(@log_mock).log_response(response)
66
+
67
+ assert @log_mock.verify
68
+ end
69
+ end
data/test/support.rb CHANGED
@@ -9,9 +9,9 @@ module Omise
9
9
  class Test < Minitest::Test
10
10
  def before_setup
11
11
  Omise.test!
12
- Omise.vault_key = "pkey_test_4yq6tct0llin5nyyi5l"
13
- Omise.api_key = "skey_test_4yq6tct0lblmed2yp5t"
14
- Omise.api_version = nil
12
+ Omise.api_version = nil
13
+ Omise.public_api_key = "pkey_test_4yq6tct0llin5nyyi5l"
14
+ Omise.secret_api_key = "skey_test_4yq6tct0lblmed2yp5t"
15
15
  end
16
16
 
17
17
  def setup
@@ -24,5 +24,20 @@ module Omise
24
24
  instance_exec(&block)
25
25
  end
26
26
  end
27
+
28
+ private
29
+
30
+ def without_keys
31
+ original_vault_key = Omise.vault_key
32
+ original_api_key = Omise.api_key
33
+
34
+ Omise.vault_key = nil
35
+ Omise.api_key = nil
36
+
37
+ yield
38
+
39
+ Omise.vault_key = original_vault_key
40
+ Omise.api_key = original_api_key
41
+ end
27
42
  end
28
43
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Clart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.0
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.8.0
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.1
33
+ version: '1.8'
34
34
  type: :runtime
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.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 5.4.2
89
+ version: '5.4'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 5.4.2
96
+ version: '5.4'
97
97
  description:
98
98
  email:
99
99
  - robin@omise.co
@@ -127,6 +127,7 @@ files:
127
127
  - lib/omise/document_list.rb
128
128
  - lib/omise/error.rb
129
129
  - lib/omise/event.rb
130
+ - lib/omise/http_logger.rb
130
131
  - lib/omise/link.rb
131
132
  - lib/omise/list.rb
132
133
  - lib/omise/object.rb
@@ -209,10 +210,12 @@ files:
209
210
  - test/omise/test_balance.rb
210
211
  - test/omise/test_card.rb
211
212
  - test/omise/test_charge.rb
213
+ - test/omise/test_config.rb
212
214
  - test/omise/test_customer.rb
213
215
  - test/omise/test_dispute.rb
214
216
  - test/omise/test_document.rb
215
217
  - test/omise/test_event.rb
218
+ - test/omise/test_http_logger.rb
216
219
  - test/omise/test_link.rb
217
220
  - test/omise/test_list.rb
218
221
  - test/omise/test_recipient.rb
@@ -245,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
248
  version: '0'
246
249
  requirements: []
247
250
  rubyforge_project:
248
- rubygems_version: 2.5.1
251
+ rubygems_version: 2.6.8
249
252
  signing_key:
250
253
  specification_version: 4
251
254
  summary: Omise Ruby client
@@ -314,10 +317,12 @@ test_files:
314
317
  - test/omise/test_balance.rb
315
318
  - test/omise/test_card.rb
316
319
  - test/omise/test_charge.rb
320
+ - test/omise/test_config.rb
317
321
  - test/omise/test_customer.rb
318
322
  - test/omise/test_dispute.rb
319
323
  - test/omise/test_document.rb
320
324
  - test/omise/test_event.rb
325
+ - test/omise/test_http_logger.rb
321
326
  - test/omise/test_link.rb
322
327
  - test/omise/test_list.rb
323
328
  - test/omise/test_recipient.rb