aaww 0.0.1 → 0.0.3

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: b43b95e164340d449ceafaef81ab3aa391da2ca7
4
- data.tar.gz: 2ab1033062975db6a1364f79d2313d1d9fa9198d
3
+ metadata.gz: f01ae663aa7e27fab44602d9b679da74357ffd29
4
+ data.tar.gz: bbac4615a80359de068e0b3fc52eac084c720bad
5
5
  SHA512:
6
- metadata.gz: a447bd86ef75ee6434424630afb6273272b2025f750a7b6ca7de74af92e11b6abdfbdd3c40cf60cddfe175a829d11b72faa9f3d86c46673991d2a3a025fc6132
7
- data.tar.gz: cc563a109d9ea70475e5a43572d48fd82eb5fadde7e00e2cad63e1834106895f5837349044c908b7633bcb2712a4f1427e9cfa91fba32c63604fc45fdee6c1a0
6
+ metadata.gz: f941f269adb4875568c97147f148d2ab37069fcdec3b027874b11351ab00b057e0ece15402f98202c1574fe28ef47ecbe6986c3fc16ffc40f55a61c8deeb0d36
7
+ data.tar.gz: 7bc829032135d5899db31d279c764c761e61107dba9c043d1994906a3b2bf3f88a1395dd8f07efa0b66d7c9abf7a1aed3315b42846507dbc19981ae61a1e5036
@@ -26,6 +26,8 @@ module Aaww
26
26
  end
27
27
 
28
28
  def upload!
29
+ create_token if token.nil?
30
+
29
31
  response = Aaww.post '/api3/api_upload_partner_stl', query: upload_query
30
32
  self.link = response['data']['token_link']
31
33
  self.ssl_link = response['data']['ssl_token_link']
@@ -1,3 +1,3 @@
1
1
  module Aaww
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -63,28 +63,49 @@ describe Aaww::Transaction do
63
63
  end
64
64
 
65
65
  describe '#upload!' do
66
- subject do
67
- Aaww::Transaction.new key: 'fake_test_key', token: 'fake_test_token',
68
- file: sample_stl, email: 'email@example.com', value: 1, job_id: 69
69
- end
66
+ describe 'with token' do
67
+ subject do
68
+ Aaww::Transaction.new key: 'fake_test_key', token: 'fake_test_token',
69
+ file: sample_stl, email: 'email@example.com', value: 1, job_id: 69
70
+ end
70
71
 
71
- before do
72
- VCR.use_cassette 'upload' do
73
- @response = subject.upload!
72
+ before do
73
+ VCR.use_cassette 'upload' do
74
+ @response = subject.upload!
75
+ end
74
76
  end
75
- end
76
77
 
77
- it 'returns the response' do
78
- @response.must_be_instance_of Hash
79
- @response['status']['code'].must_equal 'ok'
80
- end
78
+ it 'returns the response' do
79
+ @response.must_be_instance_of Hash
80
+ @response['status']['code'].must_equal 'ok'
81
+ end
81
82
 
82
- it 'saves the link' do
83
- subject.link.must_equal @response['data']['token_link']
83
+ it 'saves the link' do
84
+ subject.link.must_equal @response['data']['token_link']
85
+ end
86
+
87
+ it 'saves the ssl link' do
88
+ subject.ssl_link.must_equal @response['data']['ssl_token_link']
89
+ end
84
90
  end
85
91
 
86
- it 'saves the ssl link' do
87
- subject.ssl_link.must_equal @response['data']['ssl_token_link']
92
+ describe 'without token' do
93
+ subject do
94
+ Aaww::Transaction.new key: 'fake_test_key',
95
+ file: sample_stl, email: 'email@example.com', value: 1, job_id: 69
96
+ end
97
+
98
+ it 'generates a token' do
99
+ subject.token.must_be_nil
100
+
101
+ VCR.use_cassette 'create_token' do
102
+ VCR.use_cassette 'upload' do
103
+ subject.upload!
104
+ end
105
+ end
106
+
107
+ subject.token.must_equal 'fake_test_token'
108
+ end
88
109
  end
89
110
  end
90
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aaww
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - La Inventoría
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty