kiik-api 0.1.8 → 0.1.9

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: e1928ec5fdddfe6440469a3de2bcf50963694dac
4
- data.tar.gz: b634864088e68a781a945b6c0dd6aa8114a6043c
3
+ metadata.gz: d4c66563b3a4325c18593c136607eb03736d78ff
4
+ data.tar.gz: a2225bd9ec1e35ed3cd04a9fd4ec7ec98cf00806
5
5
  SHA512:
6
- metadata.gz: 97828038a43c69b829f2d61c3eb403e50cf987ab304fe5c7362db3d3659c341913a4122503f2e98ba2adcdf6c846573d71f734042e89dcf8c5a0a09896ec5136
7
- data.tar.gz: 77167f69cfe54bcea633ceb8555c98e37abf4706224950334d75e7443ef6f9545860532193c57208c4f8b7fedbc56d0b9da3467864db500d24e8c9ea7075dd0f
6
+ metadata.gz: 18c289c08a17982d7c373937b7be0b21e5cc63f20c1f81276772e53ca6e8049ec1059747a290530093c4ba94bb6569e8cb855250572e22c78c162daa8e420d52
7
+ data.tar.gz: 7e6c2ce875d3e13dc2dabbeb7e71e01a62fb2e67a0586feb334dfa98830faf729bed2d5e7ee5bcca1840865fb8a2620757899e23e4e137f2c96e8665cf1611f6
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  s.add_dependency "multi_json", "~> 1.3"
58
58
  s.add_dependency "multi_xml", "~> 0.5"
59
59
  s.add_dependency "rack", "~> 1.5"
60
+ s.add_dependency "factory_girl", "~> 4.0"
60
61
 
61
62
  end
62
63
 
@@ -45,8 +45,12 @@ module Kiik
45
45
  Kiik::Logger.info(url)
46
46
 
47
47
  response = connection.run_request(verb, url, opts[:body], authorization_header(opts[:headers])) do |req|
48
+ Kiik::Logger.inspect(req)
48
49
  yield(req) if block_given?
49
50
  end
51
+
52
+ Kiik::Logger.inspect(response)
53
+
50
54
  response = Response.new(response, :parse => opts[:parse])
51
55
 
52
56
  case response.status
@@ -1,3 +1,3 @@
1
1
  module Kiik
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -2,7 +2,6 @@ require "spec_helper"
2
2
 
3
3
  describe Kiik do
4
4
 
5
-
6
5
  context 'initialization' do
7
6
 
8
7
  before(:each) do
@@ -45,11 +44,8 @@ describe Kiik do
45
44
  expect(wallet.client.authorization_header({})['Authorization']).to eq('Token token=098f6bcd4621d373cade4e832627b4f6')
46
45
  end
47
46
 
48
-
49
-
50
47
  end
51
48
 
52
49
  end
53
50
 
54
-
55
51
  end
@@ -9,6 +9,9 @@ describe Kiik do
9
9
  describe Kiik::Wallet::Client do
10
10
 
11
11
  let(:wallet) { Kiik.wallet }
12
+ let!(:user) { build(:user) }
13
+ let!(:card) { build(:card) }
14
+ let!(:transaction) { build(:transaction, :credit_card => build(:credit_card) ) }
12
15
 
13
16
  context "initialization" do
14
17
 
@@ -17,7 +20,41 @@ describe Kiik do
17
20
  end
18
21
 
19
22
  it 'should set the user api ' do
20
- expect(wallet.user.login(:id => "123123-1231231-12312-31231", :password => "teste123" )).not_to be_nil
23
+ wallet.user.login(user) do |response|
24
+ expect(response['token']).not_to be_nil
25
+ end
26
+ end
27
+
28
+ it 'should use the token to create a card' do
29
+ wallet.user.login(user) do |response|
30
+
31
+ card[:token] = response['token']
32
+
33
+ wallet.create(:creditcard, card) do |response|
34
+ expect(response['credit_card_token']).not_to be_nil
35
+ end
36
+ end
37
+ end
38
+
39
+ it 'should use the token to create a card and make a transaction' do
40
+
41
+ wallet.user.login(user) do |response|
42
+
43
+ token = response['token']
44
+
45
+ card[:token] = token
46
+
47
+ wallet.create(:creditcard, card) do |response|
48
+
49
+ transaction[:token] = token
50
+ transaction[:credit_card][:token] = response['credit_card_token']
51
+
52
+ wallet.create(:transaction, transaction ) do |response|
53
+ expect(response).not_to be_nil
54
+ end
55
+
56
+ end
57
+ end
21
58
  end
22
59
 
23
60
  end
@@ -6,6 +6,10 @@
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
7
 
8
8
  require 'kiik-api'
9
+ require 'factory_girl'
10
+
11
+ require_relative './factories.rb'
12
+
9
13
  begin
10
14
  require 'redgreen'
11
15
  rescue LoadError
@@ -21,6 +25,7 @@ RSpec.configure do |config|
21
25
  # the seed, which is printed after each run.
22
26
  # --seed 1234
23
27
  config.order = 'random'
28
+ config.include FactoryGirl::Syntax::Methods
24
29
  end
25
30
 
26
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiik-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno de Queiroz
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '1.5'
209
+ - !ruby/object:Gem::Dependency
210
+ name: factory_girl
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '4.0'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '4.0'
209
223
  description: A Gem for Kiik API
210
224
  email: creativelikeadog@gmail.com
211
225
  executables: []
@@ -252,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
266
  version: '0'
253
267
  requirements: []
254
268
  rubyforge_project:
255
- rubygems_version: 2.4.5
269
+ rubygems_version: 2.2.2
256
270
  signing_key:
257
271
  specification_version: 4
258
272
  summary: A Gem for Kiik API