pmp 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pmp/parser.rb +2 -2
- data/lib/pmp/version.rb +1 -1
- data/spec/client_spec.rb +2 -2
- data/spec/collection_document_spec.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e7ac8db962f9e688afb289a6e61e0fa61775ffa
|
4
|
+
data.tar.gz: a20438ab58d2336b6f925f22e1813310a0bb01be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92996e6770ba266693cad6d941a8423882772d99b6e49fbee7b24c3930f8cf4da829581741118eaa3afc48b5441858a78b40d4717be0b81c2d153258584fc2e9
|
7
|
+
data.tar.gz: 934228fc26f99102bb61dae5e2ca6a4d97d184d0dcb9b1b65bf738652a53fb515265eba1a5fe69d8dd7cc53e0775509f73f1b1ebc22e57fe5c9290e5e3c675f0
|
data/lib/pmp/parser.rb
CHANGED
data/lib/pmp/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe PMP::Client do
|
|
28
28
|
to_return(:status => 200, :body => root_doc, :headers => {})
|
29
29
|
|
30
30
|
@root = @pmp.root
|
31
|
-
@root.creator.must_be_instance_of PMP::Link
|
31
|
+
@root.creator.first.must_be_instance_of PMP::Link
|
32
32
|
end
|
33
33
|
|
34
34
|
it "calls the root doc when client does not have method" do
|
@@ -38,7 +38,7 @@ describe PMP::Client do
|
|
38
38
|
with(:headers => {'Accept'=>'application/vnd.pmp.collection.doc+json', 'Content-Type'=>'application/vnd.pmp.collection.doc+json', 'Host'=>'api.pmp.io:443'}).
|
39
39
|
to_return(:status => 200, :body => root_doc, :headers => {})
|
40
40
|
|
41
|
-
@pmp.creator.must_be_instance_of PMP::Link
|
41
|
+
@pmp.creator.first.must_be_instance_of PMP::Link
|
42
42
|
end
|
43
43
|
|
44
44
|
|
@@ -66,10 +66,10 @@ describe PMP::CollectionDocument do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should set-up links" do
|
69
|
-
@doc.profile.must_be_instance_of PMP::Link
|
70
|
-
@doc.profile.href.must_equal "http://api-sandbox.pmp.io/profiles/story"
|
71
|
-
@doc.self.href.must_equal "http://api-sandbox.pmp.io/docs/f84e9018-5c21-4b32-93f8-d519308620f0"
|
72
|
-
@doc.collection.href.must_equal "http://api-sandbox.pmp.io/docs/"
|
69
|
+
@doc.profile.first.must_be_instance_of PMP::Link
|
70
|
+
@doc.profile.first.href.must_equal "http://api-sandbox.pmp.io/profiles/story"
|
71
|
+
@doc.self.first.href.must_equal "http://api-sandbox.pmp.io/docs/f84e9018-5c21-4b32-93f8-d519308620f0"
|
72
|
+
@doc.collection.first.href.must_equal "http://api-sandbox.pmp.io/docs/"
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should serialize to collection.doc+json" do
|
@@ -93,7 +93,7 @@ describe PMP::CollectionDocument do
|
|
93
93
|
with(:headers => {'Accept'=>'application/vnd.pmp.collection.doc+json', 'Authorization'=>'Bearer thisisatesttoken', 'Content-Type'=>'application/vnd.pmp.collection.doc+json', 'Host'=>'api.pmp.io:443'}).
|
94
94
|
to_return(:status => 200, :body => root_doc, :headers => {})
|
95
95
|
|
96
|
-
@doc = PMP::CollectionDocument.new(oauth_token: 'thisisatesttoken', href: "https://api.pmp.io/")
|
96
|
+
@doc = PMP::CollectionDocument.new(oauth_token: 'thisisatesttoken', href: "https://api.pmp.io/", client_id: "fake", client_secret: "fake")
|
97
97
|
}
|
98
98
|
|
99
99
|
it "should use oauth token" do
|
@@ -111,7 +111,7 @@ describe PMP::CollectionDocument do
|
|
111
111
|
|
112
112
|
stub_request(:post, "https://api.pmp.io/auth/access_token").
|
113
113
|
with(:body => {"grant_type"=>"client_credentials"},
|
114
|
-
:headers => {'Accept'=>'application/json', 'Authorization'=>'Basic
|
114
|
+
:headers => {'Accept'=>'application/json', 'Authorization'=>'Basic ZmFrZTpmYWtl', 'Content-Type'=>'application/x-www-form-urlencoded', 'Host'=>'api.pmp.io:443'}).
|
115
115
|
to_return(:status => 200, :body => response_body, :headers => {'Content-Type' => 'application/json; charset=utf-8'})
|
116
116
|
|
117
117
|
@doc.oauth_token = nil
|
@@ -132,7 +132,7 @@ describe PMP::CollectionDocument do
|
|
132
132
|
|
133
133
|
it "should load lazily when attr not found" do
|
134
134
|
@doc.wont_be :loaded
|
135
|
-
creator = @doc.creator
|
135
|
+
creator = @doc.creator.first
|
136
136
|
@doc.must_be :loaded
|
137
137
|
creator.must_be_instance_of PMP::Link
|
138
138
|
end
|
@@ -140,7 +140,7 @@ describe PMP::CollectionDocument do
|
|
140
140
|
it "should provide a list of links" do
|
141
141
|
@doc.load
|
142
142
|
@doc.links.keys.sort.must_equal ["creator", "edit", "navigation", "query"]
|
143
|
-
@doc.links['creator'].must_be_instance_of PMP::Link
|
143
|
+
@doc.links['creator'].first.must_be_instance_of PMP::Link
|
144
144
|
end
|
145
145
|
|
146
146
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kuklewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|