spike-ruby 0.0.3 → 0.1.0

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: b3a4e9fb8aad6e8d754bcaf6a888af457423d80d
4
- data.tar.gz: a87e25103fba6aad2a56ff8dd4e811b552bbaee0
3
+ metadata.gz: 31f68145f80f9dc598e7dafa6fd57bedf6dfef5e
4
+ data.tar.gz: 36d9dd820845fcf5732cc0ddfe712ca92af23605
5
5
  SHA512:
6
- metadata.gz: b33514b2895e64754e1be43906074e006a9073bebc56b19e4b87838563ae9ab0a503abc07c29017d0f37ac3862458ccb45c1d22030d7cd31492529688b0d2b5a
7
- data.tar.gz: 8192285c61da000a7635eb6e525a9651d81163d292ccbf41e73b596dadcbc0ece4ded294f6d117253dbad7515bf4d6dbc1bfbce90c9efe3e932900d377d47f95
6
+ metadata.gz: 2b8bc200a76617dca57d498234f5d60319a3cf136cf9d45c6a9ca1d6f9dade88c2c42f3921f41684f74c3ddf5e1c767baad70ee6926ca19cd531f469ad8cb42f
7
+ data.tar.gz: bcb7840e86dc991e6b240e22eedf60ea19dbf5315e41cd9328dd75d20a55b655700c49c892296157e554ec332d592d6e490dd897a352cb0de1659f0ffc7dcd8b
@@ -0,0 +1,21 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-04-20 11:03:32 +0900 using RuboCop version 0.39.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+ LineLength:
9
+ Max: 120
10
+ ClassAndModuleChildren:
11
+ EnforcedStyle: compact
12
+ Style/MethodLength:
13
+ Max: 20
14
+ Style/PredicateName:
15
+ Enabled: false
16
+
17
+ AllCops:
18
+ TargetRubyVersion: 2.2
19
+ Exclude:
20
+ - 'bin/test.rb'
21
+
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # spike-ruby ![build status](https://circleci.com/gh/spice-life/spike-ruby.png?style=shield&circle-token=793417d2dc17daaef4dfba6afb6552e4ca4c1023)
1
+ # spike-ruby ![build status](https://circleci.com/gh/matsubo/spike-ruby.png?style=shield&circle-token=7f07d86695915d7a1d34ca37491c3825b5eea2c4)
2
2
 
3
3
  [SPIKE](https://spike.cc/) API Client for Ruby.
4
4
 
@@ -21,12 +21,12 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- ### Create charge
24
+ ### Example: Create charge
25
25
 
26
26
  ```ruby
27
27
  require 'spike'
28
28
 
29
- spike = Spike.new(spike_secret_apie_key)
29
+ spike = Spike.new(spike_secret_api_key)
30
30
 
31
31
  request_params = {
32
32
  amount: 1000,
@@ -38,27 +38,20 @@ Or install it yourself as:
38
38
  description: "item description",
39
39
  price: 1000,
40
40
  stock: 10,
41
+ language: "JA",
41
42
  count: 1,
42
43
  currency: "JPY",
43
44
  id: "00001"
44
45
  }]
45
46
 
46
- spike.charge.create(request_parmas, products)
47
+ spike.charge.create(request_params, products)
47
48
  ```
48
49
 
49
- ## Get credit card token
50
-
51
- ```shell
52
- $ gem install sinatra
53
- $ SPIKE_PUBLIC_KEY=pk_xxxxxxx ruby checkoutapp.rb
54
- ```
55
-
56
- Access to http://localhost:4567
57
-
58
50
  ## Contributing
59
51
 
60
52
  1. Fork it ( https://github.com/spice-life/spike-ruby/fork )
61
53
  2. Create your feature branch (`git checkout -b my-new-feature`)
62
- 3. Commit your changes (`git commit -am 'Add some feature'`)
63
- 4. Push to the branch (`git push origin my-new-feature`)
64
- 5. Create a new Pull Request
54
+ 3. Pass tests (`bundle exec rspec`)
55
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 5. Push to the branch (`git push origin my-new-feature`)
57
+ 6. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
 
3
3
  require 'rspec/core'
4
4
  require 'rspec/core/rake_task'
@@ -7,4 +7,4 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
7
7
  spec.pattern = FileList['spec/**/*_spec.rb']
8
8
  end
9
9
 
10
- task default: "spec"
10
+ task default: 'spec'
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'spike'
5
+ require 'pp'
6
+
7
+ spike_secret_api_key = ENV['SECRET_KEY'] || STDERR.puts('set SECRET_KEY variable'); exit
8
+
9
+ spike = Spike.new(spike_secret_api_key)
10
+
11
+ charges = spike.charge.list
12
+ pp charges.data.first.class
13
+
14
+ token_params = {
15
+ 'card[number]' => '4444333322221111',
16
+ 'card[exp_month]' => '3',
17
+ 'card[exp_year]' => '2017',
18
+ 'card[cvc]' => '111',
19
+ 'card[name]' => 'TARO SPIKE',
20
+ 'currency' => 'JPY',
21
+ 'email' => 'foo@example.com'
22
+ }
23
+
24
+ token = spike.token.create(token_params)
25
+
26
+ token = spike.token.retrieve(token.id)
27
+ pp token
28
+
29
+ request_params = {
30
+ amount: 1000,
31
+ currency: 'JPY',
32
+ card: token.id
33
+ }
34
+ products = [{
35
+ id: '00001',
36
+ title: 'item title',
37
+ description: 'item description',
38
+ language: 'ja',
39
+ price: 1000,
40
+ stock: 10,
41
+ count: 1,
42
+ currency: 'JPY'
43
+ }]
44
+
45
+ charge = spike.charge.create(request_params, products)
46
+
47
+ charges = spike.charge.list(limit: 5)
data/circle.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  machine:
2
2
  ruby:
3
- version: 2.1.0
3
+ version: 2.3.0
@@ -1,11 +1,17 @@
1
- require 'spike/version'
2
- require 'spike/charge'
3
1
  require 'spike/error'
2
+ require 'spike/object'
3
+ require 'spike/charge'
4
+ require 'spike/token'
5
+ require 'curb'
4
6
 
7
+ #
8
+ # Main class
9
+ #
5
10
  class Spike
6
- API_BASE = 'https://api.spike.cc'
7
- API_VERSION = '/v1'
8
- API_URL = API_BASE+API_VERSION
11
+ VERSION = '0.1.0'.freeze
12
+ API_BASE = 'https://api.spike.cc'.freeze
13
+ API_VERSION = '/v1'.freeze
14
+ API_URL = API_BASE + API_VERSION
9
15
 
10
16
  def initialize(secret_token)
11
17
  @secret_token = secret_token
@@ -15,8 +21,14 @@ class Spike
15
21
  Spike::Charge.new(self)
16
22
  end
17
23
 
18
- def get(request_path:)
19
- c = build_curl(request_path)
24
+ def token
25
+ Spike::Token.new(self)
26
+ end
27
+
28
+ def get(request_path:, request_params: {})
29
+ require 'active_support/core_ext/object/to_query'
30
+
31
+ c = build_curl(request_path + '?' + request_params.to_query)
20
32
  basic_auth(c)
21
33
 
22
34
  c.http_get
@@ -29,7 +41,7 @@ class Spike
29
41
  c = build_curl(request_path)
30
42
  basic_auth(c)
31
43
 
32
- curb_post_fields = request_params.map {|k,v| Curl::PostField.content(k,v)}
44
+ curb_post_fields = request_params.map { |k, v| Curl::PostField.content(k, v) }
33
45
  c.http_post(c.url, *curb_post_fields)
34
46
 
35
47
  handle_response(c)
@@ -37,10 +49,10 @@ class Spike
37
49
  end
38
50
 
39
51
  private
52
+
40
53
  def build_curl(request_path)
41
54
  c = Curl::Easy.new
42
55
  c.url = API_URL + request_path
43
- c.verbose = true
44
56
  c
45
57
  end
46
58
 
@@ -58,6 +70,8 @@ class Spike
58
70
  raise Spike::UnauthorizedError
59
71
  when 402
60
72
  raise Spike::RequestFailedError
73
+ when 404
74
+ raise Spike::NotFoundError
61
75
  when 500
62
76
  raise Spike::ApiServerError
63
77
  end
@@ -1,69 +1,98 @@
1
- require 'json'
1
+ #
2
+ # Charge feature
3
+ #
4
+ class Spike::Charge
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def create(params, products)
10
+ require 'json'
11
+ res = @client.post(request_path: '/charges', request_params: params.merge(products: JSON.generate(products)))
12
+ Spike::Charge::Response.new(res)
13
+ end
2
14
 
3
- class Spike
4
- class Charge
5
- def initialize(client)
6
- @client = client
15
+ def retrieve(charge_id)
16
+ res = @client.get(request_path: "/charges/#{charge_id}")
17
+ Response.new(res)
18
+ end
19
+
20
+ def list(params = {})
21
+ res = @client.get(request_path: '/charges', request_params: params)
22
+ Spike::Charge::List.new(res)
23
+ end
24
+
25
+ #
26
+ # List object
27
+ #
28
+ class List < Spike::Object
29
+ def object
30
+ @attributes['object']
7
31
  end
8
32
 
9
- def create(params, products)
10
- res = @client.post(request_path: "/charges", request_params: params.merge(products: JSON.generate(products)))
11
- Spike::Charge::Response.new(res)
33
+ def url
34
+ @attributes['url']
12
35
  end
13
36
 
14
- def retrieve(charge_id)
15
- res = @client.get(request_path: "/charges/#{charge_id}")
16
- Spike::Charge::Response.new(res)
37
+ def has_more?
38
+ @attributes['has_more']
17
39
  end
18
40
 
19
- class Spike::Charge::Response
20
- def initialize(hash)
21
- @attributes = Hash[hash.map{|k,v| [k.to_s, v] }]
22
- end
41
+ def data
42
+ @attributes['data'].collect { |d| Spike::Charge::Response.new(d) }
43
+ end
44
+ end
23
45
 
24
- def id
25
- @attributes['id']
26
- end
46
+ #
47
+ # Charge object
48
+ #
49
+ class Response
50
+ def initialize(hash)
51
+ @attributes = Hash[hash.map { |k, v| [k.to_s, v] }]
52
+ end
27
53
 
28
- def object
29
- @attributes['object']
30
- end
54
+ def id
55
+ @attributes['id']
56
+ end
31
57
 
32
- def created_at
33
- Time.at(@attributes['created'])
34
- end
58
+ def object
59
+ @attributes['object']
60
+ end
35
61
 
36
- def live_mode?
37
- @attributes['livemode']
38
- end
62
+ def created_at
63
+ Time.at(@attributes['created'])
64
+ end
39
65
 
40
- def paid?
41
- @attributes['paid']
42
- end
66
+ def live_mode?
67
+ @attributes['livemode']
68
+ end
69
+
70
+ def paid?
71
+ @attributes['paid']
72
+ end
43
73
 
44
- def captured?
45
- @attributes['captured']
46
- end
74
+ def captured?
75
+ @attributes['captured']
76
+ end
47
77
 
48
- def amount
49
- @attributes['amount'].to_f
50
- end
78
+ def amount
79
+ @attributes['amount'].to_f
80
+ end
51
81
 
52
- def currency
53
- @attributes['currency']
54
- end
82
+ def currency
83
+ @attributes['currency']
84
+ end
55
85
 
56
- def refunded?
57
- @attributes['refunded']
58
- end
86
+ def refunded?
87
+ @attributes['refunded']
88
+ end
59
89
 
60
- def amount_refunded
61
- @attributes['amount_refunded']
62
- end
90
+ def amount_refunded
91
+ @attributes['amount_refunded']
92
+ end
63
93
 
64
- def refunds
65
- @attributes['refunds']
66
- end
94
+ def refunds
95
+ @attributes['refunds']
67
96
  end
68
97
  end
69
98
  end
@@ -2,5 +2,6 @@ class Spike
2
2
  class BadRequestError < StandardError; end
3
3
  class UnauthorizedError < StandardError; end
4
4
  class RequestFailedError < StandardError; end
5
+ class NotFoundError < StandardError; end
5
6
  class ApiServerError < StandardError; end
6
7
  end
@@ -0,0 +1,12 @@
1
+ #
2
+ # Spike shared Object
3
+ #
4
+ class Spike::Object
5
+ def initialize(hash)
6
+ @attributes = Hash[hash.map { |k, v| [k.to_s, v] }]
7
+ end
8
+
9
+ def object
10
+ @attributes['object']
11
+ end
12
+ end
@@ -0,0 +1,47 @@
1
+ #
2
+ # Token feature
3
+ #
4
+ class Spike::Token
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ def create(params)
10
+ res = @client.post(request_path: '/tokens', request_params: params)
11
+ Spike::Token::Response.new(res)
12
+ end
13
+
14
+ def retrieve(token_id)
15
+ res = @client.get(request_path: "/tokens/#{token_id}")
16
+ Response.new(res)
17
+ end
18
+
19
+ #
20
+ # Token Object
21
+ #
22
+ class Response < Spike::Object
23
+ def id
24
+ @attributes['id']
25
+ end
26
+
27
+ def live_mode?
28
+ @attributes['livemode']
29
+ end
30
+
31
+ def created
32
+ Time.at(@attributes['created'])
33
+ end
34
+
35
+ def type
36
+ @attributes['type']
37
+ end
38
+
39
+ def currency
40
+ @attributes['currency']
41
+ end
42
+
43
+ def source
44
+ @attributes['source']
45
+ end
46
+ end
47
+ end
@@ -1,3 +1,2 @@
1
1
  class Spike
2
- VERSION = "0.0.3"
3
2
  end
@@ -1,6 +1,20 @@
1
1
  require 'bundler'
2
2
  Bundler.require(:default, :development)
3
3
 
4
+ if ENV['CIRCLE_ARTIFACTS']
5
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
6
+ SimpleCov.coverage_dir(dir)
7
+ end
8
+
9
+ SimpleCov.formatters = [
10
+ SimpleCov::Formatter::HTMLFormatter
11
+ ]
12
+
13
+ SimpleCov.adapters.define 'spike' do
14
+ add_filter '/spec/'
15
+ end
16
+ SimpleCov.start 'spike'
17
+
4
18
  require 'spike'
5
19
 
6
20
  VCR.configure do |c|
@@ -10,5 +24,5 @@ VCR.configure do |c|
10
24
  end
11
25
 
12
26
  RSpec.configure do |config|
13
- config.order = "random"
27
+ config.order = 'random'
14
28
  end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spike::Charge do
4
+ let(:secret_api_key) { 'sk_test_IFWHL5kDDZFV72KtPyBp0leO' }
5
+
6
+ describe 'create new charge' do
7
+ let(:token) { 'tok_bUEcGsUHKT84WwCp4clFrLYv' }
8
+ let(:products) do
9
+ [
10
+ {
11
+ title: '商品',
12
+ description: '商品説明',
13
+ language: 'ja',
14
+ price: 900,
15
+ currency: 'JPY',
16
+ count: 1,
17
+ id: '00001',
18
+ stock: 10
19
+ }
20
+ ]
21
+ end
22
+ let(:request_params) { { amount: 900, currency: 'JPY', card: token } }
23
+
24
+ subject do
25
+ res = nil
26
+ VCR.use_cassette 'lib/spike_create_charge' do
27
+ res = Spike.new(secret_api_key).charge.create(request_params, products)
28
+ end
29
+ res
30
+ end
31
+
32
+ it { expect(subject.id).not_to eq nil }
33
+ it { expect(subject.object).to eq 'charge' }
34
+ it { expect(subject).to_not be_live_mode }
35
+ it { expect(subject).to be_paid }
36
+ it { expect(subject).to be_captured }
37
+ it { expect(subject.amount).to eq 900.0 }
38
+ it { expect(subject.currency).to eq 'JPY' }
39
+ it { expect(subject).to_not be_refunded }
40
+ it { expect(subject.amount_refunded).to be_nil }
41
+ it { expect(subject.refunds).to be_empty }
42
+ end
43
+
44
+ describe 'get charge' do
45
+ subject do
46
+ res = nil
47
+ VCR.use_cassette 'lib/spike_get_charge' do
48
+ res = Spike.new(secret_api_key).charge.retrieve('20160418-100308-ywci76')
49
+ end
50
+ end
51
+
52
+ it { expect(subject.object).to eq 'charge' }
53
+ it { expect(subject).to_not be_live_mode }
54
+ it { expect(subject).to be_paid }
55
+ it { expect(subject).to be_captured }
56
+ it { expect(subject.amount).to eq 900.0 }
57
+ it { expect(subject.currency).to eq 'JPY' }
58
+ it { expect(subject).to_not be_refunded }
59
+ it { expect(subject.amount_refunded).to be_nil }
60
+ it { expect(subject.refunds).to be_empty }
61
+ end
62
+
63
+ describe 'get charges' do
64
+ subject do
65
+ res = nil
66
+ VCR.use_cassette 'lib/spike_list_charges' do
67
+ res = Spike.new(secret_api_key).charge.list
68
+ end
69
+ end
70
+
71
+ it { expect(subject.object).to eq 'list' }
72
+ it { expect(subject.data.class).to be Array }
73
+ end
74
+ end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spike::Token do
4
+ let(:secret_api_key) { 'sk_test_IFWHL5kDDZFV72KtPyBp0leO' }
5
+
6
+ describe 'create new token ' do
7
+ let(:token) { 'tok_rNUiMLP32pYQkpe2PqYAUuHK' }
8
+ let(:request_params) do
9
+ {
10
+ 'card[number]' => '4444333322221111',
11
+ 'card[exp_month]' => '3',
12
+ 'card[exp_year]' => '2017',
13
+ 'card[cvc]' => '111',
14
+ 'card[name]' => 'TARO SPIKE',
15
+ 'currency' => 'JPY',
16
+ 'email' => 'foo@example.com'
17
+ }
18
+ end
19
+
20
+ subject do
21
+ res = nil
22
+ VCR.use_cassette 'lib/spike_create_token' do
23
+ res = Spike.new(secret_api_key).token.create(request_params)
24
+ end
25
+ res
26
+ end
27
+
28
+ it { expect(subject.id).not_to eq nil }
29
+ it { expect(subject.object).to eq 'token' }
30
+ it { expect(subject).to_not be_live_mode }
31
+ it { expect(subject.created.class).to eq Time }
32
+ it { expect(subject.type).to eq 'card' }
33
+ it { expect(subject.currency).to eq 'JPY' }
34
+ it { expect(subject.source.class).to eq Hash }
35
+ end
36
+
37
+ describe 'get token' do
38
+ subject do
39
+ res = nil
40
+ VCR.use_cassette 'lib/spike_get_token' do
41
+ res = Spike.new(secret_api_key).token.retrieve('tok_PG2Kltpdi9FlEsvJwaPILRxT')
42
+ end
43
+ end
44
+
45
+ it { expect(subject.object).to eq 'token' }
46
+ it { expect(subject).to_not be_live_mode }
47
+ it { expect(subject.type).to eq 'card' }
48
+ it { expect(subject.currency).to eq 'JPY' }
49
+ end
50
+ end
@@ -1,48 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spike::Charge do
4
- let(:secret_api_key) { 'sk_test_Lkg0iMrN5x02S7e4WVE5FgTj' }
5
-
6
- describe 'create new charge' do
7
- let(:token) { 'tok_rNUiMLP32pYQkpe2PqYAUuHK' }
8
- let(:products) { [{title: '商品', description: '商品説明', language: 'JA', price: 900, currency: 'JPY', count: 1, id: '00001', stock: 10}]}
9
- let(:request_params) { { amount: 900, currency: 'JPY', card: token } }
3
+ describe Spike do
4
+ let(:secret_api_key) { 'sk_test_IFWHL5kDDZFV72KtPyBp0leO' }
10
5
 
6
+ describe 'to raise Spike::NotFoundError' do
11
7
  subject do
12
- res = nil
13
- VCR.use_cassette 'lib/spike_create_charge' do
14
- res = Spike.new(secret_api_key).charge.create(request_params, products)
8
+ VCR.use_cassette 'lib/not_found' do
9
+ Spike.new(secret_api_key).get(request_path: 'not_found_path')
15
10
  end
16
- res
17
11
  end
18
12
 
19
- it { expect(subject.object).to eq 'charge' }
20
- it { expect(subject).to_not be_live_mode }
21
- it { expect(subject).to be_paid }
22
- it { expect(subject).to be_captured }
23
- it { expect(subject.amount).to eq 900.0 }
24
- it { expect(subject.currency).to eq 'JPY' }
25
- it { expect(subject).to_not be_refunded }
26
- it { expect(subject.amount_refunded).to be_nil }
27
- it { expect(subject.refunds).to be_empty }
13
+ it { expect { subject }.to raise_error Spike::NotFoundError }
28
14
  end
29
15
 
30
- describe 'get charge' do
16
+ describe 'to raise Spike::UnauthorizedError' do
17
+ let(:secret_api_key) { 'invalid_secret_key' }
18
+
31
19
  subject do
32
- res = nil
33
- VCR.use_cassette 'lib/spike_get_charge' do
34
- res = Spike.new(secret_api_key).charge.retrieve("20141007-113905-mj7atv4rkg")
20
+ VCR.use_cassette 'lib/unauthorized_error' do
21
+ Spike.new(secret_api_key).get(request_path: '/charges')
35
22
  end
36
23
  end
37
24
 
38
- it { expect(subject.object).to eq 'charge' }
39
- it { expect(subject).to_not be_live_mode }
40
- it { expect(subject).to be_paid }
41
- it { expect(subject).to be_captured }
42
- it { expect(subject.amount).to eq 900.0 }
43
- it { expect(subject.currency).to eq 'JPY' }
44
- it { expect(subject).to_not be_refunded }
45
- it { expect(subject.amount_refunded).to be_nil }
46
- it { expect(subject.refunds).to be_empty }
25
+ it { expect { subject }.to raise_error Spike::UnauthorizedError }
47
26
  end
48
27
  end
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1not_found_path
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ Content-Type:
16
+ - application/json; charset=utf-8
17
+ Date:
18
+ - Mon, 18 Apr 2016 10:18:18 GMT
19
+ Server:
20
+ - nginx
21
+ Status:
22
+ - 404 Not Found
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Request-Id:
28
+ - ecd471cb-7e4f-46d4-b508-3c37abceeeef
29
+ X-Runtime:
30
+ - '0.005859'
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ Content-Length:
34
+ - '21'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: ASCII-8BIT
39
+ string: '{"error":"not-found"}'
40
+ http_version:
41
+ recorded_at: Mon, 18 Apr 2016 10:18:18 GMT
42
+ recorded_with: VCR 3.0.1
@@ -2,10 +2,10 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://sk_test_Lkg0iMrN5x02S7e4WVE5FgTj:@api.spike.cc/v1/charges
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1/charges
6
6
  body:
7
7
  encoding: UTF-8
8
- string: https://api.spike.cc/v1/charges&amount=900&currency=JPY&card=tok_rNUiMLP32pYQkpe2PqYAUuHK&products=%5B%7B%22title%22%3A%22%E5%95%86%E5%93%81%22%2C%22description%22%3A%22%E5%95%86%E5%93%81%E8%AA%AC%E6%98%8E%22%2C%22language%22%3A%22JA%22%2C%22price%22%3A900%2C%22currency%22%3A%22JPY%22%2C%22count%22%3A1%2C%22id%22%3A%2200001%22%2C%22stock%22%3A10%7D%5D
8
+ string: https://api.spike.cc/v1/charges&amount=900&currency=JPY&card=tok_bUEcGsUHKT84WwCp4clFrLYv&products=%5B%7B%22title%22%3A%22%E5%95%86%E5%93%81%22%2C%22description%22%3A%22%E5%95%86%E5%93%81%E8%AA%AC%E6%98%8E%22%2C%22language%22%3A%22ja%22%2C%22price%22%3A900%2C%22currency%22%3A%22JPY%22%2C%22count%22%3A1%2C%22id%22%3A%2200001%22%2C%22stock%22%3A10%7D%5D
9
9
  headers: {}
10
10
  response:
11
11
  status:
@@ -17,24 +17,24 @@ http_interactions:
17
17
  Content-Type:
18
18
  - application/json
19
19
  Date:
20
- - Tue, 07 Oct 2014 11:39:05 GMT
20
+ - Mon, 18 Apr 2016 10:05:03 GMT
21
21
  Etag:
22
- - '"20f59ea808e5712eb3dcf1378658c6c6"'
22
+ - W/"0eb51b104649a9e44ab7e0a1ebca23e1"
23
23
  Server:
24
24
  - nginx
25
25
  Status:
26
26
  - 201 Created
27
27
  X-Request-Id:
28
- - ebc65445-26b6-439d-a0db-f84b2013dec0
28
+ - a5fd7b6a-9c89-4fd8-a1fa-19ff60e17d86
29
29
  X-Runtime:
30
- - '0.249048'
30
+ - '0.272823'
31
31
  Content-Length:
32
- - '392'
32
+ - '399'
33
33
  Connection:
34
34
  - keep-alive
35
35
  body:
36
36
  encoding: ASCII-8BIT
37
- string: '{"id":"20141007-113905-mj7atv4rkg","object":"charge","created":1412681945,"livemode":false,"paid":true,"amount":"900.0","currency":"JPY","refunded":false,"card":{},"captured":true,"refunds":[],"balance_transaction":"","failure_message":null,"failure_code":null,"amount_refunded":null,"customer":null,"invoice":null,"description":null,"dispute":null,"metadata":{},"statement_description":null}'
37
+ string: '{"id":"20160418-100503-8e1is2","object":"charge","created":1460973903,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null}'
38
38
  http_version:
39
- recorded_at: Tue, 07 Oct 2014 11:39:05 GMT
40
- recorded_with: VCR 2.9.3
39
+ recorded_at: Mon, 18 Apr 2016 10:05:03 GMT
40
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1/tokens
6
+ body:
7
+ encoding: UTF-8
8
+ string: https://api.spike.cc/v1/tokens&card%5Bnumber%5D=4444333322221111&card%5Bexp_month%5D=3&card%5Bexp_year%5D=2017&card%5Bcvc%5D=111&card%5Bname%5D=TARO%20SPIKE&currency=JPY&email=foo%40example.com
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 201
13
+ message: Created
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - application/json
19
+ Date:
20
+ - Mon, 18 Apr 2016 09:25:07 GMT
21
+ Etag:
22
+ - W/"aa125d2b5d270900fea5b74acb4c403e"
23
+ Server:
24
+ - nginx
25
+ Status:
26
+ - 201 Created
27
+ X-Request-Id:
28
+ - ac7fff78-0ea3-45a2-97d0-849104879401
29
+ X-Runtime:
30
+ - '0.135450'
31
+ Content-Length:
32
+ - '230'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: ASCII-8BIT
37
+ string: '{"id":"tok_yDSyDoL0l18IrNiPfdMmc9cm","object":"token","created":1460971507,"livemode":false,"type":"card","currency":"JPY","source":{"object":"card","last4":"1111","brand":"Visa","exp_month":3,"exp_year":2017,"name":"TARO
38
+ SPIKE"}}'
39
+ http_version:
40
+ recorded_at: Mon, 18 Apr 2016 09:25:07 GMT
41
+ recorded_with: VCR 3.0.1
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://sk_test_Lkg0iMrN5x02S7e4WVE5FgTj:@api.spike.cc/v1/charges/20141007-113905-mj7atv4rkg
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1/charges/20160418-100308-ywci76
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -17,24 +17,24 @@ http_interactions:
17
17
  Content-Type:
18
18
  - application/json
19
19
  Date:
20
- - Tue, 07 Oct 2014 12:10:04 GMT
20
+ - Mon, 18 Apr 2016 10:05:03 GMT
21
21
  Etag:
22
- - '"20f59ea808e5712eb3dcf1378658c6c6"'
22
+ - W/"c8a6570043e3b3e8f69172d9a8b0258f"
23
23
  Server:
24
24
  - nginx
25
25
  Status:
26
26
  - 200 OK
27
27
  X-Request-Id:
28
- - b1783930-6a6a-4b04-8f1a-6132e74bb014
28
+ - 9bd57151-eb8a-49eb-800a-2168a970554f
29
29
  X-Runtime:
30
- - '0.024541'
30
+ - '0.061840'
31
31
  Content-Length:
32
- - '392'
32
+ - '399'
33
33
  Connection:
34
34
  - keep-alive
35
35
  body:
36
36
  encoding: ASCII-8BIT
37
- string: '{"id":"20141007-113905-mj7atv4rkg","object":"charge","created":1412681945,"livemode":false,"paid":true,"amount":"900.0","currency":"JPY","refunded":false,"card":{},"captured":true,"refunds":[],"balance_transaction":"","failure_message":null,"failure_code":null,"amount_refunded":null,"customer":null,"invoice":null,"description":null,"dispute":null,"metadata":{},"statement_description":null}'
37
+ string: '{"id":"20160418-100308-ywci76","object":"charge","created":1460973788,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null}'
38
38
  http_version:
39
- recorded_at: Tue, 07 Oct 2014 12:10:04 GMT
40
- recorded_with: VCR 2.9.3
39
+ recorded_at: Mon, 18 Apr 2016 10:05:03 GMT
40
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1/tokens/tok_PG2Kltpdi9FlEsvJwaPILRxT
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - application/json
19
+ Date:
20
+ - Mon, 18 Apr 2016 09:25:07 GMT
21
+ Etag:
22
+ - W/"8b5943138c9f6f3359a3e085d9b5e277"
23
+ Server:
24
+ - nginx
25
+ Status:
26
+ - 200 OK
27
+ X-Request-Id:
28
+ - 521896e2-dec5-4068-9be0-b65e1d668fb8
29
+ X-Runtime:
30
+ - '0.024174'
31
+ Content-Length:
32
+ - '230'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: ASCII-8BIT
37
+ string: '{"id":"tok_PG2Kltpdi9FlEsvJwaPILRxT","object":"token","created":1460971472,"livemode":false,"type":"card","currency":"JPY","source":{"object":"card","last4":"1111","brand":"Visa","exp_month":3,"exp_year":2017,"name":"TARO
38
+ SPIKE"}}'
39
+ http_version:
40
+ recorded_at: Mon, 18 Apr 2016 09:25:07 GMT
41
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sk_test_IFWHL5kDDZFV72KtPyBp0leO:@api.spike.cc/v1/charges
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - application/json
19
+ Date:
20
+ - Mon, 18 Apr 2016 10:05:03 GMT
21
+ Etag:
22
+ - W/"6d1ecf337b776f7f29c099bdc8b9967a"
23
+ Server:
24
+ - nginx
25
+ Status:
26
+ - 200 OK
27
+ X-Request-Id:
28
+ - 47b01401-5ac7-46ec-832b-07bcda0d9b4f
29
+ X-Runtime:
30
+ - '0.164772'
31
+ Content-Length:
32
+ - '4068'
33
+ Connection:
34
+ - keep-alive
35
+ body:
36
+ encoding: ASCII-8BIT
37
+ string: '{"object":"list","url":"/v1/charges","has_more":true,"data":[{"id":"20160418-100308-ywci76","object":"charge","created":1460973788,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-100241-7ah6uj","object":"charge","created":1460973761,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-100007-eu2x1q","object":"charge","created":1460973607,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-095712-74gn68","object":"charge","created":1460973432,"livemode":false,"paid":true,"amount":900,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-095609-d5ncmp","object":"charge","created":1460973369,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-095533-xo1ve3","object":"charge","created":1460973333,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-085949-3w45yj","object":"charge","created":1460969989,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-085302-v0n1fz","object":"charge","created":1460969582,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-083539-x4b7rg","object":"charge","created":1460968539,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null},{"id":"20160418-083516-89f1s5","object":"charge","created":1460968516,"livemode":false,"paid":true,"amount":1000,"currency":"JPY","refunded":false,"source":{},"captured":true,"refunds":[],"amount_refunded":null,"authenticated":false,"attempt_authenticated":false,"authenticated_at":null,"authorization":null,"customer":null,"description":null,"dispute":null,"metadata":{},"statement_descriptor":null}]}'
38
+ http_version:
39
+ recorded_at: Mon, 18 Apr 2016 10:05:03 GMT
40
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://invalid_secret_key:@api.spike.cc/v1/charges
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 401
13
+ message: Unauthorized
14
+ headers:
15
+ Cache-Control:
16
+ - no-cache
17
+ Content-Type:
18
+ - application/json
19
+ Date:
20
+ - Mon, 18 Apr 2016 10:23:21 GMT
21
+ Server:
22
+ - nginx
23
+ Status:
24
+ - 401 Unauthorized
25
+ X-Request-Id:
26
+ - 62b776d0-b1a2-4b1f-9801-858273eb8b47
27
+ X-Runtime:
28
+ - '0.012375'
29
+ Content-Length:
30
+ - '309'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: ASCII-8BIT
35
+ string: !binary |-
36
+ eyJlcnJvciI6eyJ0eXBlIjoiYXV0aGVudGljYXRpb25fZXJyb3IiLCJjb2Rl
37
+ IjoiaW52YWxpZF9hcGlfa2V5IiwibWVzc2FnZSI6IkFQSeOCreODvOOBjOmW
38
+ k+mBleOBo+OBpuOBhOOBvuOBmeOAgkF1dGhvcml6YXRpb27jg5jjg4Pjg4Dj
39
+ gavmraPjgZfjgYRBUEnjgq3jg7zjgpLoqK3lrprjgZfjgabjgY/jgaDjgZXj
40
+ gYTjgILoqbPntLDjga/jgZPjgaHjgonvvJpodHRwczovc3Bpa2UuY2MvZG9j
41
+ cy9hcGkjYXV0aGVudGljYXRpb27jgILjgYrllY/jgYTlkIjjgo/jgZvjga/j
42
+ gZPjgaHjgonvvJpodHRwczovL3N1cHBvcnQuc3Bpa2UuY2MvIn19
43
+ http_version:
44
+ recorded_at: Mon, 18 Apr 2016 10:23:21 GMT
45
+ recorded_with: VCR 3.0.1
@@ -1,30 +1,33 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'spike/version'
4
+ require 'spike'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "spike-ruby"
7
+ spec.name = 'spike-ruby'
8
8
  spec.version = Spike::VERSION
9
- spec.authors = ["AKAMATSU Yuki"]
10
- spec.email = ["y.akamatsu@ukstudio.jp"]
11
- spec.summary = %q{Ruby library for SPIKE API}
12
- spec.description = %q{Ruby library for SPIKE API}
13
- spec.homepage = "http://github.com/spice-life/spike-ruby"
14
- spec.license = "MIT"
9
+ spec.authors = ['AKAMATSU Yuki', 'Yuki Matsukura']
10
+ spec.email = ['y.akamatsu@ukstudio.jp', 'matsubokkuri@gmail.com']
11
+ spec.summary = 'Ruby library for SPIKE API'
12
+ spec.description = 'Ruby library for SPIKE API'
13
+ spec.homepage = 'http://github.com/matsubo/spike-ruby'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.required_ruby_version = ">=2.0.0"
21
+ spec.required_ruby_version = '>=2.1.0'
22
22
 
23
- spec.add_development_dependency "bundler", ">= 1.0.0"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", ">= 3.0.0"
26
- spec.add_development_dependency "webmock"
27
- spec.add_development_dependency "vcr"
23
+ spec.add_development_dependency 'bundler', '>= 1.0.0'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
26
+ spec.add_development_dependency 'webmock'
27
+ spec.add_development_dependency 'vcr'
28
+ spec.add_development_dependency 'simplecov'
29
+ spec.add_development_dependency 'rubocop'
28
30
 
29
- spec.add_dependency "curb", "~> 0.8.6"
31
+ spec.add_dependency 'curb', '~> 0.8.6'
32
+ spec.add_dependency 'activesupport', '>=3.0.0'
30
33
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spike-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AKAMATSU Yuki
8
+ - Yuki Matsukura
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-10-07 00:00:00.000000000 Z
12
+ date: 2016-04-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -80,6 +81,34 @@ dependencies:
80
81
  - - ">="
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: simplecov
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
83
112
  - !ruby/object:Gem::Dependency
84
113
  name: curb
85
114
  requirement: !ruby/object:Gem::Requirement
@@ -94,32 +123,57 @@ dependencies:
94
123
  - - "~>"
95
124
  - !ruby/object:Gem::Version
96
125
  version: 0.8.6
126
+ - !ruby/object:Gem::Dependency
127
+ name: activesupport
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 3.0.0
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 3.0.0
97
140
  description: Ruby library for SPIKE API
98
141
  email:
99
142
  - y.akamatsu@ukstudio.jp
100
- executables: []
143
+ - matsubokkuri@gmail.com
144
+ executables:
145
+ - test.rb
101
146
  extensions: []
102
147
  extra_rdoc_files: []
103
148
  files:
104
149
  - ".gitignore"
105
150
  - ".rspec"
151
+ - ".rubocop.yml"
106
152
  - Gemfile
107
153
  - LICENSE.txt
108
154
  - README.md
109
155
  - Rakefile
110
- - checkoutapp.rb
111
- - checkoutapp/index.haml
156
+ - bin/test.rb
112
157
  - circle.yml
113
158
  - lib/spike.rb
114
159
  - lib/spike/charge.rb
115
160
  - lib/spike/error.rb
161
+ - lib/spike/object.rb
162
+ - lib/spike/token.rb
116
163
  - lib/spike/version.rb
117
164
  - spec/spec_helper.rb
165
+ - spec/spike/charge_spec.rb
166
+ - spec/spike/token_spec.rb
118
167
  - spec/spike_spec.rb
168
+ - spec/vcr/lib/not_found.yml
119
169
  - spec/vcr/lib/spike_create_charge.yml
170
+ - spec/vcr/lib/spike_create_token.yml
120
171
  - spec/vcr/lib/spike_get_charge.yml
172
+ - spec/vcr/lib/spike_get_token.yml
173
+ - spec/vcr/lib/spike_list_charges.yml
174
+ - spec/vcr/lib/unauthorized_error.yml
121
175
  - spike-ruby.gemspec
122
- homepage: http://github.com/spice-life/spike-ruby
176
+ homepage: http://github.com/matsubo/spike-ruby
123
177
  licenses:
124
178
  - MIT
125
179
  metadata: {}
@@ -131,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
185
  requirements:
132
186
  - - ">="
133
187
  - !ruby/object:Gem::Version
134
- version: 2.0.0
188
+ version: 2.1.0
135
189
  required_rubygems_version: !ruby/object:Gem::Requirement
136
190
  requirements:
137
191
  - - ">="
@@ -139,12 +193,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
193
  version: '0'
140
194
  requirements: []
141
195
  rubyforge_project:
142
- rubygems_version: 2.2.2
196
+ rubygems_version: 2.5.1
143
197
  signing_key:
144
198
  specification_version: 4
145
199
  summary: Ruby library for SPIKE API
146
200
  test_files:
147
201
  - spec/spec_helper.rb
202
+ - spec/spike/charge_spec.rb
203
+ - spec/spike/token_spec.rb
148
204
  - spec/spike_spec.rb
205
+ - spec/vcr/lib/not_found.yml
149
206
  - spec/vcr/lib/spike_create_charge.yml
207
+ - spec/vcr/lib/spike_create_token.yml
150
208
  - spec/vcr/lib/spike_get_charge.yml
209
+ - spec/vcr/lib/spike_get_token.yml
210
+ - spec/vcr/lib/spike_list_charges.yml
211
+ - spec/vcr/lib/unauthorized_error.yml
212
+ has_rdoc:
@@ -1,10 +0,0 @@
1
- require 'sinatra'
2
- require 'haml'
3
-
4
- set :views, settings.root + '/checkoutapp'
5
-
6
- get '/' do
7
- fail('missing SPIKE_PUBLIC_KEY env') if ENV['SPIKE_PUBLIC_KEY'].nil? || ENV['SPIKE_PUBLIC_KEY'].empty?
8
- @public_key = ENV['SPIKE_PUBLIC_KEY']
9
- haml :index
10
- end
@@ -1,27 +0,0 @@
1
- !!!
2
-
3
- %html
4
- %body
5
- %button#customButton submit
6
-
7
- %script{type: 'text/javascript', src: 'https://checkout.spike.cc/v1/checkout.js'}
8
-
9
- :javascript
10
- var handler = SpikeCheckout.configure({
11
- key: "#{@public_key}",
12
- token: function(token, args) {
13
- console.log(token.id);
14
- }
15
- });
16
-
17
-
18
- document.getElementById("customButton").addEventListener("click", function(e) {
19
- handler.open({
20
- name: "Sample app for get token",
21
- amount: 900,
22
- currency: "JPY",
23
- guest: true,
24
- email: "foo@example.com"
25
- });
26
- e.preventDefault();
27
- });