passety 0.0.11 → 0.0.12

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.travis.yml +1 -1
  4. data/Gemfile.lock +1 -1
  5. data/lib/passety/collection.rb +0 -4
  6. data/lib/passety/collections/thing.rb +3 -1
  7. data/lib/passety/nested_item.rb +0 -4
  8. data/lib/passety/property.rb +1 -1
  9. data/lib/passety/response.rb +0 -12
  10. data/lib/passety/version.rb +1 -1
  11. data/lib/passety/wrapper.rb +0 -4
  12. data/spec/collections_spec.rb +126 -0
  13. data/spec/properties_spec.rb +75 -0
  14. data/spec/things_spec.rb +100 -0
  15. data/spec/vcr/collections/all.yml +53 -0
  16. data/spec/vcr/collections/create.yml +54 -0
  17. data/spec/vcr/collections/delete.yml +46 -0
  18. data/spec/vcr/collections/find.yml +52 -0
  19. data/spec/vcr/collections/things/all.yml +52 -0
  20. data/spec/vcr/collections/things/create.yml +52 -0
  21. data/spec/vcr/collections/things/delete.yml +46 -0
  22. data/spec/vcr/collections/things/remove.yml +46 -0
  23. data/spec/vcr/collections/update.yml +52 -0
  24. data/spec/vcr/common/info.yml +52 -0
  25. data/spec/vcr/common/search.yml +52 -0
  26. data/spec/vcr/common/uploads.yml +56 -0
  27. data/spec/vcr/things/all.yml +55 -0
  28. data/spec/vcr/things/create.yml +54 -0
  29. data/spec/vcr/things/delete.yml +46 -0
  30. data/spec/vcr/things/find.yml +52 -0
  31. data/spec/vcr/things/photos/all.yml +52 -0
  32. data/spec/vcr/things/photos/create.yml +54 -0
  33. data/spec/vcr/things/properties/all.yml +52 -0
  34. data/spec/vcr/things/properties/create.yml +54 -0
  35. data/spec/vcr/things/properties/delete.yml +46 -0
  36. data/spec/vcr/things/properties/find.yml +52 -0
  37. data/spec/vcr/things/update.yml +52 -0
  38. data/spec/wrapper_spec.rb +41 -15
  39. metadata +55 -6
  40. data/spec/item_spec.rb +0 -14
  41. data/spec/property_spec.rb +0 -13
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.passety.com/things/AABAM/properties/
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"key":"description","value":"Thing Description"}'
9
+ headers:
10
+ Accept:
11
+ - application/json; version=1
12
+ Authorization:
13
+ - Bearer thVEvafigsp9nCMGiA5XlOSQ2lzNCBLl
14
+ User-Agent:
15
+ - Faraday v0.9.0
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 201
21
+ message: Created
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.0
25
+ Date:
26
+ - Fri, 06 Jun 2014 11:37:35 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Location:
40
+ - https://api.passety.com/things/AABAM/properties/description
41
+ Etag:
42
+ - '"79cc1f40d67688b18ea098a1393611f4"'
43
+ Cache-Control:
44
+ - max-age=0, private, must-revalidate
45
+ X-Request-Id:
46
+ - dd72fb05-e41b-4676-a5bb-c96bc745dadb
47
+ X-Runtime:
48
+ - '0.054676'
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"key":"description","value":"Thing Description","created_at":"2014-06-06T11:37:35.854Z"}'
52
+ http_version:
53
+ recorded_at: Fri, 06 Jun 2014 11:37:35 GMT
54
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.passety.com/things/AABAM/properties/%7B:key=%3E%22description%22%7D
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json; version=1
12
+ Authorization:
13
+ - Bearer thVEvafigsp9nCMGiA5XlOSQ2lzNCBLl
14
+ User-Agent:
15
+ - Faraday v0.9.0
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 204
21
+ message: No Content
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.0
25
+ Date:
26
+ - Fri, 06 Jun 2014 11:41:24 GMT
27
+ Connection:
28
+ - keep-alive
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Cache-Control:
36
+ - no-cache
37
+ X-Request-Id:
38
+ - ef406522-6c3f-4dd8-95d6-c26e29808b93
39
+ X-Runtime:
40
+ - '0.037247'
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version:
45
+ recorded_at: Fri, 06 Jun 2014 11:41:24 GMT
46
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.passety.com/things/AABAM/properties/description
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json; version=1
12
+ Authorization:
13
+ - Bearer thVEvafigsp9nCMGiA5XlOSQ2lzNCBLl
14
+ User-Agent:
15
+ - Faraday v0.9.0
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.0
25
+ Date:
26
+ - Fri, 06 Jun 2014 11:35:30 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Etag:
40
+ - '"a3f0d4aaa74b2610a879d7823ad178bf"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 128a73df-d28a-4252-b973-cf824076bd3c
45
+ X-Runtime:
46
+ - '0.029951'
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"key":"description","value":"Thing description","created_at":"2014-06-06T11:35:03.837Z"}'
50
+ http_version:
51
+ recorded_at: Fri, 06 Jun 2014 11:35:30 GMT
52
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.passety.com/things/AABAM
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Canon 600D"}'
9
+ headers:
10
+ Accept:
11
+ - application/json; version=1
12
+ Authorization:
13
+ - Bearer thVEvafigsp9nCMGiA5XlOSQ2lzNCBLl
14
+ User-Agent:
15
+ - Faraday v0.9.0
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx/1.6.0
25
+ Date:
26
+ - Fri, 06 Jun 2014 10:27:43 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ Etag:
40
+ - '"0418286d14e6e8d883b6c088a8f7499a"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 7bdfbff6-ca2d-431b-931a-2fe24787472e
45
+ X-Runtime:
46
+ - '1.038894'
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"id":"AABAM","name":"Canon 600D","private":false,"picture":"http://passety.dev/assets/thing-blank-slate.png","created_at":"2014-06-03T12:12:47.344Z","updated_at":"2014-06-06T10:27:42.214Z","category":null}'
50
+ http_version:
51
+ recorded_at: Fri, 06 Jun 2014 10:27:43 GMT
52
+ recorded_with: VCR 2.9.0
@@ -1,27 +1,53 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Passety::Wrapper do
4
- let(:app_id) { 'app_id' }
5
- let(:secret) { 'secret' }
6
- let(:token) { 'w32vd234231rr' }
7
-
3
+ describe Passety::Wrapper, vcr: true do
4
+ let(:token) { 'thVEvafigsp9nCMGiA5XlOSQ2lzNCBLl' }
8
5
  let(:wrapper) { Passety::Wrapper.new(token) }
9
- let(:tid) { 'AABAJ' }
6
+ let(:collection_id) { 1 }
7
+ let(:tid) { 'AABAM' }
10
8
 
11
- before do
12
- stub_request(:post, "#{Passety::API_URL}/things/")
13
- stub_request(:post, "#{Passety::API_URL}/things/#{tid}")
9
+ it 'has API url set to Passety API endpoint' do
10
+ connection = wrapper.send(:connection)
11
+ expect(connection.url_prefix.to_s).to match(Passety::API_URL)
14
12
  end
15
13
 
16
- it 'authenticates user after initializing' do
17
- wrapper.should be_authorized
14
+ context 'Application Info', vcr: { cassette_name: 'common/info' } do
15
+ subject(:result) { wrapper.info }
16
+
17
+ it 'has 200 (OK) status' do
18
+ expect(result.status).to eq(200)
19
+ end
20
+
21
+ it 'has information about application' do
22
+ expect(result.parsed['resources']['core']).to include('limit')
23
+ end
18
24
  end
19
25
 
20
- it 'initializes things object' do
21
- wrapper.things.should_not be_nil
26
+ context 'Searching Items', vcr: { cassette_name: 'common/search' } do
27
+ let(:name) { 'Nikon D3100' }
28
+ subject(:result) { wrapper.search(:name) }
29
+
30
+ it 'has 200 (OK) status' do
31
+ expect(result.status).to eq(200)
32
+ end
33
+
34
+ it 'has information about searched thing' do
35
+ expect(result.parsed).to include("items")
36
+ end
37
+
38
+ it 'is paginated' do
39
+ expect(result.parsed).to include('meta')
40
+ end
22
41
  end
23
42
 
24
- it 'initializes properties object' do
25
- wrapper.things.properties.should_not be_nil
43
+ context 'Uploads' do
44
+ context 'Create an upload', vcr: { cassette_name: 'common/uploads' } do
45
+ let(:file) { double(tempfile: double(read: nil), content_type: 'image/jpg', original_filename: 'grumpy.jpg') }
46
+ subject(:result) { wrapper.uploads.create(file: file, type: :photo) }
47
+
48
+ it 'has 201 (Created) status' do
49
+ expect(result.status).to eq(201)
50
+ end
51
+ end
26
52
  end
27
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passety
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Passety Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - .gitignore
148
+ - .rspec
148
149
  - .travis.yml
149
150
  - Gemfile
150
151
  - Gemfile.lock
@@ -167,9 +168,33 @@ files:
167
168
  - lib/passety/version.rb
168
169
  - lib/passety/wrapper.rb
169
170
  - passety.gemspec
170
- - spec/item_spec.rb
171
- - spec/property_spec.rb
171
+ - spec/collections_spec.rb
172
+ - spec/properties_spec.rb
172
173
  - spec/spec_helper.rb
174
+ - spec/things_spec.rb
175
+ - spec/vcr/collections/all.yml
176
+ - spec/vcr/collections/create.yml
177
+ - spec/vcr/collections/delete.yml
178
+ - spec/vcr/collections/find.yml
179
+ - spec/vcr/collections/things/all.yml
180
+ - spec/vcr/collections/things/create.yml
181
+ - spec/vcr/collections/things/delete.yml
182
+ - spec/vcr/collections/things/remove.yml
183
+ - spec/vcr/collections/update.yml
184
+ - spec/vcr/common/info.yml
185
+ - spec/vcr/common/search.yml
186
+ - spec/vcr/common/uploads.yml
187
+ - spec/vcr/things/all.yml
188
+ - spec/vcr/things/create.yml
189
+ - spec/vcr/things/delete.yml
190
+ - spec/vcr/things/find.yml
191
+ - spec/vcr/things/photos/all.yml
192
+ - spec/vcr/things/photos/create.yml
193
+ - spec/vcr/things/properties/all.yml
194
+ - spec/vcr/things/properties/create.yml
195
+ - spec/vcr/things/properties/delete.yml
196
+ - spec/vcr/things/properties/find.yml
197
+ - spec/vcr/things/update.yml
173
198
  - spec/wrapper_spec.rb
174
199
  homepage: https://github.com/passety/passety-ruby
175
200
  licenses:
@@ -196,7 +221,31 @@ signing_key:
196
221
  specification_version: 4
197
222
  summary: Ruby bindings for the Passety API
198
223
  test_files:
199
- - spec/item_spec.rb
200
- - spec/property_spec.rb
224
+ - spec/collections_spec.rb
225
+ - spec/properties_spec.rb
201
226
  - spec/spec_helper.rb
227
+ - spec/things_spec.rb
228
+ - spec/vcr/collections/all.yml
229
+ - spec/vcr/collections/create.yml
230
+ - spec/vcr/collections/delete.yml
231
+ - spec/vcr/collections/find.yml
232
+ - spec/vcr/collections/things/all.yml
233
+ - spec/vcr/collections/things/create.yml
234
+ - spec/vcr/collections/things/delete.yml
235
+ - spec/vcr/collections/things/remove.yml
236
+ - spec/vcr/collections/update.yml
237
+ - spec/vcr/common/info.yml
238
+ - spec/vcr/common/search.yml
239
+ - spec/vcr/common/uploads.yml
240
+ - spec/vcr/things/all.yml
241
+ - spec/vcr/things/create.yml
242
+ - spec/vcr/things/delete.yml
243
+ - spec/vcr/things/find.yml
244
+ - spec/vcr/things/photos/all.yml
245
+ - spec/vcr/things/photos/create.yml
246
+ - spec/vcr/things/properties/all.yml
247
+ - spec/vcr/things/properties/create.yml
248
+ - spec/vcr/things/properties/delete.yml
249
+ - spec/vcr/things/properties/find.yml
250
+ - spec/vcr/things/update.yml
202
251
  - spec/wrapper_spec.rb
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Passety::Item do
4
- let(:wrapper) { double('wrapper') }
5
- let(:uri) { double('uri') }
6
-
7
- subject { Passety::Item.new(wrapper, uri) }
8
-
9
- [ :all, :find, :update, :create, :destroy ].each do |action|
10
- it "responds to #{action}" do
11
- expect(subject).to respond_to(action)
12
- end
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Passety::Property do
4
- let(:wrapper) { double('wrapper') }
5
-
6
- subject { Passety::Property.new(wrapper, 'things') }
7
-
8
- [ :all, :find, :create, :destroy ].each do |action|
9
- it "responds to #{action}" do
10
- expect(subject).to respond_to(action)
11
- end
12
- end
13
- end