harpy 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -1
- data/.travis.yml +4 -6
- data/README.md +5 -5
- data/harpy.gemspec +6 -5
- data/lib/harpy.rb +3 -2
- data/lib/harpy/gem_version.rb +14 -0
- data/lib/harpy/resource.rb +109 -93
- data/lib/harpy/version.rb +9 -0
- data/spec/harpy/client_spec.rb +27 -20
- data/spec/harpy/entry_point_spec.rb +14 -14
- data/spec/harpy/resource_spec.rb +224 -224
- data/spec/harpy_spec.rb +20 -20
- metadata +52 -52
- data/Gemfile.lock +0 -56
data/spec/harpy_spec.rb
CHANGED
@@ -4,94 +4,94 @@ describe Harpy do
|
|
4
4
|
after{ Harpy.reset }
|
5
5
|
|
6
6
|
it "defaults to Harpy::Client" do
|
7
|
-
Harpy.client.
|
7
|
+
expect(Harpy.client).to be_kind_of Harpy::Client
|
8
8
|
end
|
9
9
|
|
10
10
|
it "does allow using another client" do
|
11
11
|
custom_client = double
|
12
12
|
Harpy.client = custom_client
|
13
|
-
Harpy.client.
|
13
|
+
expect(Harpy.client).to be custom_client
|
14
14
|
end
|
15
15
|
|
16
16
|
it "has no default entry_point_url" do
|
17
|
-
Harpy.entry_point_url.
|
17
|
+
expect(Harpy.entry_point_url).to be_nil
|
18
18
|
end
|
19
19
|
|
20
20
|
it "does allow setting an entry_point_url" do
|
21
21
|
Harpy.entry_point_url = "http://localhost"
|
22
|
-
Harpy.entry_point_url.
|
22
|
+
expect(Harpy.entry_point_url).to eq("http://localhost")
|
23
23
|
end
|
24
24
|
|
25
25
|
it "raises Harpy::EntryPointRequired when trying to access entry_point and none has been created yet" do
|
26
|
-
|
26
|
+
expect{ Harpy.entry_point }.to raise_error Harpy::EntryPointRequired
|
27
27
|
end
|
28
28
|
|
29
29
|
it "returns a valid Harpy::EntryPoint object if entry_point_url has been set" do
|
30
30
|
Harpy.entry_point_url = "http://localhost"
|
31
|
-
Harpy.entry_point.
|
32
|
-
Harpy.entry_point.url.
|
31
|
+
expect(Harpy.entry_point).to be_kind_of Harpy::EntryPoint
|
32
|
+
expect(Harpy.entry_point.url).to eq("http://localhost")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does allow setting entry_point manually" do
|
36
36
|
Harpy.entry_point = (entry_point = double)
|
37
|
-
Harpy.entry_point.
|
38
|
-
entry_point.
|
39
|
-
Harpy.entry_point_url.
|
37
|
+
expect(Harpy.entry_point).to be entry_point
|
38
|
+
expect(entry_point).to receive(:url).and_return "http://localhost"
|
39
|
+
expect(Harpy.entry_point_url).to eq("http://localhost")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "Harpy.reset clears both client and entry_point" do
|
43
43
|
Harpy.entry_point_url = "http://localhost"
|
44
44
|
Harpy.client = (custom_client = double)
|
45
45
|
Harpy.reset
|
46
|
-
Harpy.entry_point_url.
|
47
|
-
Harpy.client.
|
46
|
+
expect(Harpy.entry_point_url).to be_nil
|
47
|
+
expect(Harpy.client).not_to be custom_client
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe Harpy::Exception do
|
52
52
|
it "is an ::Exception" do
|
53
|
-
Harpy::Exception.ancestors.
|
53
|
+
expect(Harpy::Exception.ancestors).to include ::Exception
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe Harpy::EntryPointRequired do
|
58
58
|
it "is an Harpy::Exception" do
|
59
|
-
Harpy::EntryPointRequired.ancestors.
|
59
|
+
expect(Harpy::EntryPointRequired.ancestors).to include Harpy::Exception
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe Harpy::UrlRequired do
|
64
64
|
it "is an Harpy::Exception" do
|
65
|
-
Harpy::UrlRequired.ancestors.
|
65
|
+
expect(Harpy::UrlRequired.ancestors).to include Harpy::Exception
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe Harpy::BodyToBig do
|
70
70
|
it "is an Harpy::Exception" do
|
71
|
-
Harpy::BodyToBig.ancestors.
|
71
|
+
expect(Harpy::BodyToBig.ancestors).to include Harpy::Exception
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe Harpy::ClientTimeout do
|
76
76
|
it "is an Harpy::Exception" do
|
77
|
-
Harpy::ClientTimeout.ancestors.
|
77
|
+
expect(Harpy::ClientTimeout.ancestors).to include Harpy::Exception
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe Harpy::ClientError do
|
82
82
|
it "is an Harpy::Exception" do
|
83
|
-
Harpy::ClientError.ancestors.
|
83
|
+
expect(Harpy::ClientError.ancestors).to include Harpy::Exception
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe Harpy::Unauthorized do
|
88
88
|
it "is an Harpy::Exception" do
|
89
|
-
Harpy::Unauthorized.ancestors.
|
89
|
+
expect(Harpy::Unauthorized.ancestors).to include Harpy::Exception
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe Harpy::InvalidResponseCode do
|
94
94
|
it "is an Harpy::Exception" do
|
95
|
-
Harpy::InvalidResponseCode.ancestors.
|
95
|
+
expect(Harpy::InvalidResponseCode.ancestors).to include Harpy::Exception
|
96
96
|
end
|
97
97
|
end
|
metadata
CHANGED
@@ -1,100 +1,100 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph HALTER
|
8
8
|
- Jonathan TRON
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 0.6.5
|
21
16
|
requirement: !ruby/object:Gem::Requirement
|
22
17
|
requirements:
|
23
|
-
- -
|
18
|
+
- - ">="
|
24
19
|
- !ruby/object:Gem::Version
|
25
20
|
version: 0.6.5
|
26
|
-
prerelease: false
|
27
21
|
type: :runtime
|
28
|
-
|
29
|
-
name: activesupport
|
22
|
+
prerelease: false
|
30
23
|
version_requirements: !ruby/object:Gem::Requirement
|
31
24
|
requirements:
|
32
|
-
- -
|
25
|
+
- - ">="
|
33
26
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
27
|
+
version: 0.6.5
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activesupport
|
35
30
|
requirement: !ruby/object:Gem::Requirement
|
36
31
|
requirements:
|
37
|
-
- -
|
32
|
+
- - ">="
|
38
33
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
40
|
-
prerelease: false
|
34
|
+
version: 5.2.0
|
41
35
|
type: :runtime
|
42
|
-
|
43
|
-
name: activemodel
|
36
|
+
prerelease: false
|
44
37
|
version_requirements: !ruby/object:Gem::Requirement
|
45
38
|
requirements:
|
46
|
-
- -
|
39
|
+
- - ">="
|
47
40
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
41
|
+
version: 5.2.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: activemodel
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
45
|
requirements:
|
51
|
-
- -
|
46
|
+
- - ">="
|
52
47
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
prerelease: false
|
48
|
+
version: 5.2.0
|
55
49
|
type: :runtime
|
56
|
-
|
57
|
-
name: hash-deep-merge
|
50
|
+
prerelease: false
|
58
51
|
version_requirements: !ruby/object:Gem::Requirement
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ">="
|
61
54
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
55
|
+
version: 5.2.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: hash-deep-merge
|
63
58
|
requirement: !ruby/object:Gem::Requirement
|
64
59
|
requirements:
|
65
|
-
- -
|
60
|
+
- - ">="
|
66
61
|
- !ruby/object:Gem::Version
|
67
62
|
version: 0.1.1
|
68
|
-
prerelease: false
|
69
63
|
type: :runtime
|
70
|
-
|
71
|
-
name: rake
|
64
|
+
prerelease: false
|
72
65
|
version_requirements: !ruby/object:Gem::Requirement
|
73
66
|
requirements:
|
74
|
-
- -
|
67
|
+
- - ">="
|
75
68
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
69
|
+
version: 0.1.1
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
77
72
|
requirement: !ruby/object:Gem::Requirement
|
78
73
|
requirements:
|
79
|
-
- -
|
74
|
+
- - ">="
|
80
75
|
- !ruby/object:Gem::Version
|
81
76
|
version: 0.8.7
|
82
|
-
prerelease: false
|
83
77
|
type: :development
|
84
|
-
|
85
|
-
name: rspec
|
78
|
+
prerelease: false
|
86
79
|
version_requirements: !ruby/object:Gem::Requirement
|
87
80
|
requirements:
|
88
|
-
- -
|
81
|
+
- - ">="
|
89
82
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
83
|
+
version: 0.8.7
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rspec
|
91
86
|
requirement: !ruby/object:Gem::Requirement
|
92
87
|
requirements:
|
93
|
-
- -
|
88
|
+
- - ">="
|
94
89
|
- !ruby/object:Gem::Version
|
95
90
|
version: '0'
|
96
|
-
prerelease: false
|
97
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
98
|
description: Client for REST API with HATEOAS
|
99
99
|
email:
|
100
100
|
- joseph.halter@thetalentbox.com
|
@@ -103,11 +103,10 @@ executables: []
|
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
|
-
- .gitignore
|
107
|
-
- .rspec
|
108
|
-
- .travis.yml
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
109
|
- Gemfile
|
110
|
-
- Gemfile.lock
|
111
110
|
- LICENSE
|
112
111
|
- README.md
|
113
112
|
- Rakefile
|
@@ -116,7 +115,9 @@ files:
|
|
116
115
|
- lib/harpy/client.rb
|
117
116
|
- lib/harpy/collection.rb
|
118
117
|
- lib/harpy/entry_point.rb
|
118
|
+
- lib/harpy/gem_version.rb
|
119
119
|
- lib/harpy/resource.rb
|
120
|
+
- lib/harpy/version.rb
|
120
121
|
- spec/harpy/client_spec.rb
|
121
122
|
- spec/harpy/entry_point_spec.rb
|
122
123
|
- spec/harpy/resource_spec.rb
|
@@ -126,24 +127,23 @@ homepage: https://github.com/TalentBox/harpy
|
|
126
127
|
licenses:
|
127
128
|
- MIT
|
128
129
|
metadata: {}
|
129
|
-
post_install_message:
|
130
|
+
post_install_message:
|
130
131
|
rdoc_options: []
|
131
132
|
require_paths:
|
132
133
|
- lib
|
133
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
135
|
requirements:
|
135
|
-
- -
|
136
|
+
- - ">="
|
136
137
|
- !ruby/object:Gem::Version
|
137
138
|
version: '0'
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
requirements:
|
140
|
-
- -
|
141
|
+
- - ">="
|
141
142
|
- !ruby/object:Gem::Version
|
142
143
|
version: '0'
|
143
144
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
145
|
+
rubygems_version: 3.0.3
|
146
|
+
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Client for REST API
|
149
149
|
test_files:
|
data/Gemfile.lock
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
harpy (1.0.0)
|
5
|
-
activemodel (>= 3.1.0)
|
6
|
-
activesupport (>= 3.1.0)
|
7
|
-
hash-deep-merge (~> 0.1.1)
|
8
|
-
typhoeus (~> 0.6.5)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: http://rubygems.org/
|
12
|
-
specs:
|
13
|
-
activemodel (4.0.2)
|
14
|
-
activesupport (= 4.0.2)
|
15
|
-
builder (~> 3.1.0)
|
16
|
-
activesupport (4.0.2)
|
17
|
-
i18n (~> 0.6, >= 0.6.4)
|
18
|
-
minitest (~> 4.2)
|
19
|
-
multi_json (~> 1.3)
|
20
|
-
thread_safe (~> 0.1)
|
21
|
-
tzinfo (~> 0.3.37)
|
22
|
-
atomic (1.1.14-java)
|
23
|
-
builder (3.1.4)
|
24
|
-
diff-lcs (1.2.4)
|
25
|
-
ethon (0.6.2)
|
26
|
-
ffi (>= 1.3.0)
|
27
|
-
mime-types (~> 1.18)
|
28
|
-
ffi (1.9.3-java)
|
29
|
-
hash-deep-merge (0.1.1)
|
30
|
-
i18n (0.6.9)
|
31
|
-
mime-types (1.25.1)
|
32
|
-
minitest (4.7.5)
|
33
|
-
multi_json (1.8.4)
|
34
|
-
rake (10.1.0)
|
35
|
-
rspec (2.14.1)
|
36
|
-
rspec-core (~> 2.14.0)
|
37
|
-
rspec-expectations (~> 2.14.0)
|
38
|
-
rspec-mocks (~> 2.14.0)
|
39
|
-
rspec-core (2.14.5)
|
40
|
-
rspec-expectations (2.14.2)
|
41
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
42
|
-
rspec-mocks (2.14.3)
|
43
|
-
thread_safe (0.1.3-java)
|
44
|
-
atomic
|
45
|
-
typhoeus (0.6.7)
|
46
|
-
ethon (~> 0.6.2)
|
47
|
-
tzinfo (0.3.38)
|
48
|
-
|
49
|
-
PLATFORMS
|
50
|
-
java
|
51
|
-
ruby
|
52
|
-
|
53
|
-
DEPENDENCIES
|
54
|
-
harpy!
|
55
|
-
rake (>= 0.8.7)
|
56
|
-
rspec
|