hyperclient 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +2 -0
  4. data/.rubocop_todo.yml +55 -0
  5. data/.travis.yml +2 -0
  6. data/CHANGELOG.md +33 -10
  7. data/CONTRIBUTING.md +117 -0
  8. data/Gemfile +2 -1
  9. data/Guardfile +6 -6
  10. data/LICENSE +2 -2
  11. data/README.md +138 -0
  12. data/Rakefile +5 -3
  13. data/UPGRADING.md +37 -0
  14. data/examples/splines_api.rb +22 -0
  15. data/features/steps/api_navigation.rb +8 -8
  16. data/features/steps/default_config.rb +6 -6
  17. data/features/support/api.rb +4 -4
  18. data/features/support/fixtures.rb +1 -1
  19. data/hyperclient.gemspec +9 -8
  20. data/lib/faraday/connection.rb +2 -2
  21. data/lib/hyperclient.rb +1 -1
  22. data/lib/hyperclient/attributes.rb +1 -1
  23. data/lib/hyperclient/collection.rb +3 -3
  24. data/lib/hyperclient/curie.rb +49 -0
  25. data/lib/hyperclient/entry_point.rb +6 -4
  26. data/lib/hyperclient/link.rb +70 -58
  27. data/lib/hyperclient/link_collection.rb +36 -11
  28. data/lib/hyperclient/resource.rb +49 -18
  29. data/lib/hyperclient/resource_collection.rb +2 -1
  30. data/lib/hyperclient/version.rb +1 -1
  31. data/test/fixtures/element.json +12 -1
  32. data/test/hyperclient/attributes_test.rb +2 -2
  33. data/test/hyperclient/collection_test.rb +6 -7
  34. data/test/hyperclient/curie_test.rb +34 -0
  35. data/test/hyperclient/entry_point_test.rb +3 -2
  36. data/test/hyperclient/link_collection_test.rb +26 -5
  37. data/test/hyperclient/link_test.rb +111 -86
  38. data/test/hyperclient/resource_collection_test.rb +2 -2
  39. data/test/hyperclient/resource_test.rb +67 -30
  40. data/test/test_helper.rb +2 -2
  41. metadata +54 -39
  42. data/Gemfile.lock +0 -112
  43. data/MIT-LICENSE +0 -20
  44. data/Readme.md +0 -180
  45. data/examples/cyberscore.rb +0 -76
  46. data/examples/hal_shop.rb +0 -53
  47. data/lib/faraday/request/digest_authentication.rb +0 -85
  48. data/test/faraday/digest_authentication_test.rb +0 -41
@@ -1,41 +0,0 @@
1
- require_relative '../test_helper'
2
- require 'faraday/request/digest_authentication'
3
-
4
- module Faraday
5
- describe Request::DigestAuth do
6
- let(:connection) do
7
- Faraday.new('http://api.example.org/') do |builder|
8
- builder.request :digest, 'USER', 'PASS'
9
- builder.adapter :net_http
10
- end
11
- end
12
-
13
- describe 'when the server does not return a 401' do
14
- it 'does nothing' do
15
- stub_request(:get, 'http://api.example.org/productions/1').
16
- to_return(status: 500, body: 'Foo body')
17
-
18
- response = connection.get('/productions/1')
19
- response.body.must_equal 'Foo body'
20
- end
21
- end
22
-
23
- describe 'when the server returns a 401' do
24
- let(:first_call_headers) { 'Digest realm="MyApp", algorithm=MD5' }
25
- let(:second_call_headers) { 'Digest username="USER", realm="MyApp", uri="/", algorithm="MD5"' }
26
- it 'authenticates using digest' do
27
- stub_request(:get, 'http://api.example.org/productions/1').
28
- with(body: nil).
29
- to_return(status: 401, headers: {'www-authenticate' => first_call_headers})
30
-
31
- stub_request(:get, 'http://api.example.org/productions/1').
32
- with(body: "{\"foo\":1}",
33
- headers: {'Authorization' => %r{second_call_headers}}).
34
- to_return(body: '{"resource": "This is the resource"}',
35
- headers: {content_type: 'application/json'})
36
-
37
- connection.get('/productions/1')
38
- end
39
- end
40
- end
41
- end