pmp 0.3.2 → 0.4.0
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 +4 -4
- data/example/permissions_result.txt +17 -17
- data/lib/pmp/client.rb +1 -1
- data/lib/pmp/collection_document.rb +35 -24
- data/lib/pmp/connection.rb +2 -2
- data/lib/pmp/credential.rb +19 -1
- data/lib/pmp/link.rb +8 -8
- data/lib/pmp/links.rb +1 -1
- 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 +30 -18
- data/spec/connection_spec.rb +1 -1
- data/spec/credential_spec.rb +10 -4
- data/spec/fixtures/collection_query.json +636 -1056
- data/spec/fixtures/collection_root.json +284 -160
- data/spec/link_spec.rb +4 -4
- data/spec/parser_spec.rb +4 -4
- metadata +2 -2
data/spec/link_spec.rb
CHANGED
@@ -60,15 +60,15 @@ describe PMP::Link do
|
|
60
60
|
link_doc = json_file(:collection_query)
|
61
61
|
|
62
62
|
stub_request(:get, "https://api-sandbox.pmp.io/docs?limit=10&tag=test").
|
63
|
-
with(:headers => {'Accept'=>'application/vnd.
|
63
|
+
with(:headers => {'Accept'=>'application/vnd.collection.doc+json', 'Content-Type'=>'application/vnd.collection.doc+json', 'Host'=>'api-sandbox.pmp.io:443'}).
|
64
64
|
to_return(:status => 200, :body => link_doc, :headers => {})
|
65
65
|
|
66
66
|
@link = PMP::Link.new(query_document_info, @parent)
|
67
67
|
docs = @link.where(limit: 10, tag: 'test')
|
68
68
|
docs.must_be_instance_of PMP::Link
|
69
69
|
guids = docs.items.collect(&:guid).sort
|
70
|
-
guids.first.must_equal "
|
71
|
-
guids.last.must_equal "
|
70
|
+
guids.first.must_equal "0c9eeb61-dba5-431a-be8e-ad74c64aad2b"
|
71
|
+
guids.last.must_equal "e77aa925-53e0-4cfd-8f16-db6146faef3e"
|
72
72
|
end
|
73
73
|
|
74
74
|
def query_document_info
|
@@ -96,7 +96,7 @@ describe PMP::Link do
|
|
96
96
|
"text" => "https://github.com/publicmediaplatform/pmpdocs/wiki/Content-Retrieval"
|
97
97
|
},
|
98
98
|
"rels" => [
|
99
|
-
"urn:
|
99
|
+
"urn:collectiondoc:query:docs"
|
100
100
|
],
|
101
101
|
"title" => "Query for documents"
|
102
102
|
}
|
data/spec/parser_spec.rb
CHANGED
@@ -15,8 +15,8 @@ class TestParser < OpenStruct
|
|
15
15
|
@links ||= PMP::Links.new(self)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
marshal_dump
|
18
|
+
def attributes_map
|
19
|
+
marshal_dump
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -54,7 +54,7 @@ describe PMP::Parser do
|
|
54
54
|
tc = TestParser.new
|
55
55
|
tc.parse(json_fixture(:collection_root))
|
56
56
|
tc.query.must_be_instance_of HashWithIndifferentAccess
|
57
|
-
tc.query.keys.sort.must_equal ["urn:
|
57
|
+
tc.query.keys.sort.must_equal ["urn:collectiondoc:hreftpl:docs", "urn:collectiondoc:hreftpl:profiles", "urn:collectiondoc:hreftpl:schemas", "urn:collectiondoc:query:docs", "urn:collectiondoc:query:groups", "urn:collectiondoc:query:guids", "urn:collectiondoc:query:profiles", "urn:collectiondoc:query:schemas", "urn:collectiondoc:query:users"]
|
58
58
|
end
|
59
59
|
|
60
60
|
it "will unparse links" do
|
@@ -63,7 +63,7 @@ describe PMP::Parser do
|
|
63
63
|
tc.links['test1'] = PMP::Link.new(href: 'https://api-sandbox.pmp.io/test1')
|
64
64
|
tc.links['test2'] = [PMP::Link.new(href: 'https://api-sandbox.pmp.io/test2a'), PMP::Link.new(href: 'https://api-sandbox.pmp.io/test2b')]
|
65
65
|
hash = tc.as_json
|
66
|
-
hash['links'].keys.sort.must_equal ["creator", "edit", "navigation", "query", "test1", "test2"]
|
66
|
+
hash['links'].keys.sort.must_equal ["auth", "bookmark", "creator", "edit", "item", "navigation", "query", "test1", "test2"]
|
67
67
|
end
|
68
68
|
|
69
69
|
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.4.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: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|