pmp 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20ab2639c7b9fadf21969f73537adca2253ff409
4
- data.tar.gz: 2bd71ffb8dcfc812eab677e8b951070475dfcfb3
3
+ metadata.gz: 2a973bed0cc15ec213cce42e732f6592d627c5e0
4
+ data.tar.gz: 3b75ef9379836b6b773e6508c111ecf4b34d4945
5
5
  SHA512:
6
- metadata.gz: 6ade468f61ff12b0a71bb8479c4145a750f6680fec62dac610f64e763923afd2d81417a60e0b5e274c127113b4da0c1e786cc86c1fac9ec153ba79368229d472
7
- data.tar.gz: 5be84ad2ec152d24da4a8d9968752a43b59380faf8e0392beb0cf747d6a09328ec5c8b27f8062fcbb3f3825af697c264f1789c1005fba12f829856a3978e16bc
6
+ metadata.gz: 6563f341fcbf74f75a8cc19731f8add4812126811710b9a02fd49bedd50efb4cd9c365a3e1eb474f4cd0260b2cb4ca374f53e0c341c926d9bd530f0be58a2fb4
7
+ data.tar.gz: 955430a5c6be07476f746f57af4b3d79efdd834447d9442495dd34da982252bcbe778ca7de8a625666c33b591f5ad5e9893420a1c161c7e13defe8816deb3401
data/lib/pmp/client.rb CHANGED
@@ -5,12 +5,17 @@ module PMP
5
5
 
6
6
  include Configuration
7
7
 
8
+ def initialize(options={}, &block)
9
+ apply_configuration(options)
10
+ yield(self) if block_given?
11
+ end
12
+
8
13
  def token(opts={})
9
- PMP::Token.new(opts).get_token
14
+ PMP::Token.new(options.merge(opts)).get_token
10
15
  end
11
16
 
12
17
  def root(opts={}, &block)
13
- PMP::CollectionDocument.new(opts, &block)
18
+ PMP::CollectionDocument.new(options.merge(opts), &block)
14
19
  end
15
20
 
16
21
  end
data/lib/pmp/parser.rb CHANGED
@@ -82,7 +82,7 @@ module PMP
82
82
  elsif info.size == 1
83
83
  Link.new(self, info.first)
84
84
  elsif info.size > 0
85
- v.map{|l| Link.new(self, l)}
85
+ info.map{|l| Link.new(self, l)}
86
86
  end
87
87
  end
88
88
 
data/lib/pmp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module PMP
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/spec/client_spec.rb CHANGED
@@ -8,8 +8,13 @@ describe PMP::Client do
8
8
  @pmp = PMP::Client.new
9
9
  }
10
10
 
11
+ it "make with options and pass along" do
12
+ pmp = PMP::Client.new(oauth_token: 'thisisatestvalueonly')
13
+ pmp.oauth_token.must_equal 'thisisatestvalueonly'
14
+ pmp.root.oauth_token.must_equal 'thisisatestvalueonly'
15
+ end
16
+
11
17
  it "returns a root api object" do
12
- @pmp = PMP::Client.new
13
18
  @pmp.root.wont_be_nil
14
19
  @pmp.root.wont_be :loaded?
15
20
  @pmp.root.href.must_equal "https://api.pmp.io/"
@@ -2,7 +2,7 @@
2
2
  "attributes": {
3
3
  "created": "2013-10-01T15:57:55+00:00",
4
4
  "guid": "04224975-e93c-4b17-9df9-96db37d318f3",
5
- "modified": "2013-10-04T14:45:34+00:00",
5
+ "modified": "2013-10-17T17:24:32+00:00",
6
6
  "published": "2013-07-04T04:00:44+00:00",
7
7
  "title": "PMP Home Document",
8
8
  "valid": {
@@ -18,8 +18,82 @@
18
18
  ],
19
19
  "edit": [
20
20
  {
21
- "href": "https://publish-sandbox.pmp.io/docs",
22
- "method": "PUT"
21
+ "hints": {
22
+ "allow": [
23
+ "PUT",
24
+ "DELETE"
25
+ ],
26
+ "docs": "https://github.com/publicmediaplatform/pmpdocs/wiki/Collection.doc-JSON-Media-Type",
27
+ "formats": [
28
+ "application/vnd.pmp.collection.doc+json"
29
+ ]
30
+ },
31
+ "href-template": "https://publish-sandbox.pmp.io/docs{/guid}",
32
+ "href-vars": {
33
+ "guid": "https://github.com/publicmediaplatform/pmpdocs/wiki/Globaly-Unique-Identifiers-for-PMP-Documents"
34
+ },
35
+ "rels": [
36
+ "urn:pmp:form:documentsave"
37
+ ],
38
+ "title": "Document Save"
39
+ },
40
+ {
41
+ "hints": {
42
+ "allow": [
43
+ "PUT",
44
+ "DELETE"
45
+ ],
46
+ "docs": "https://github.com/publicmediaplatform/pmpdocs/wiki/Profile-profile",
47
+ "formats": [
48
+ "application/vnd.pmp.collection.doc+json"
49
+ ]
50
+ },
51
+ "href-template": "https://publish-sandbox.pmp.io/profiles{/guid}",
52
+ "href-vars": {
53
+ "guid": "https://github.com/publicmediaplatform/pmpdocs/wiki/Globaly-Unique-Identifiers-for-PMP-Documents"
54
+ },
55
+ "rels": [
56
+ "urn:pmp:form:profilesave"
57
+ ],
58
+ "title": "Profile Save"
59
+ },
60
+ {
61
+ "hints": {
62
+ "allow": [
63
+ "PUT",
64
+ "DELETE"
65
+ ],
66
+ "docs": "http://json-schema.org/",
67
+ "formats": [
68
+ "application/schema+json"
69
+ ]
70
+ },
71
+ "href-template": "https://publish-sandbox.pmp.io/schemas{/guid}",
72
+ "href-vars": {
73
+ "guid": "https://github.com/publicmediaplatform/pmpdocs/wiki/Globaly-Unique-Identifiers-for-PMP-Documents"
74
+ },
75
+ "rels": [
76
+ "urn:pmp:form:schemasave"
77
+ ],
78
+ "title": "Schema Save"
79
+ },
80
+ {
81
+ "hints": {
82
+ "accept-post": [
83
+ "multipart/form-data"
84
+ ],
85
+ "allow": [
86
+ "POST"
87
+ ]
88
+ },
89
+ "href": "https://publish-sandbox.pmp.io/files",
90
+ "href-vars": {
91
+ "submission": "https://github.com/publicmediaplatform/pmpdocs/wiki/Media-File-Upload"
92
+ },
93
+ "rels": [
94
+ "urn:pmp:form:mediaupload"
95
+ ],
96
+ "title": "Upload a rich media file"
23
97
  }
24
98
  ],
25
99
  "navigation": [
@@ -75,9 +149,7 @@
75
149
  {
76
150
  "hints": {
77
151
  "allow": [
78
- "GET",
79
- "PUT",
80
- "DELETE"
152
+ "GET"
81
153
  ]
82
154
  },
83
155
  "href-template": "https://api-sandbox.pmp.io/profiles{/guid}",
@@ -92,9 +164,7 @@
92
164
  {
93
165
  "hints": {
94
166
  "allow": [
95
- "GET",
96
- "PUT",
97
- "DELETE"
167
+ "GET"
98
168
  ]
99
169
  },
100
170
  "href-template": "https://api-sandbox.pmp.io/schemas{/guid}",
@@ -110,9 +180,7 @@
110
180
  {
111
181
  "hints": {
112
182
  "allow": [
113
- "GET",
114
- "PUT",
115
- "DELETE"
183
+ "GET"
116
184
  ]
117
185
  },
118
186
  "href-template": "https://api-sandbox.pmp.io/docs{/guid}{?limit,offset}",
@@ -155,24 +223,22 @@
155
223
  "title": "Query for documents"
156
224
  },
157
225
  {
226
+ "hints": {
227
+ "accept-post": [
228
+ "application/x-www-form-urlencoded"
229
+ ],
230
+ "allow": [
231
+ "POST"
232
+ ]
233
+ },
158
234
  "href": "https://api-sandbox.pmp.io/guids",
159
- "method": "POST",
160
235
  "rels": [
161
236
  "urn:pmp:query:guids"
162
237
  ],
163
238
  "title": "Generate guids",
164
239
  "type": "application/json"
165
- },
166
- {
167
- "href": "https://publish-sandbox.pmp.io/files",
168
- "method": "POST",
169
- "rels": [
170
- "urn:pmp:query:files"
171
- ],
172
- "title": "Upload media files",
173
- "type": "multipart/form-data"
174
240
  }
175
241
  ]
176
242
  },
177
243
  "version": "1.0"
178
- }
244
+ }
data/spec/parser_spec.rb CHANGED
@@ -42,7 +42,7 @@ describe PMP::Parser do
42
42
  tc = TestParser.new
43
43
  tc.parse(json_fixture(:collection_root))
44
44
  tc.query.must_be_instance_of Hash
45
- tc.query.keys.sort.must_equal ["urn:pmp:hreftpl:docs", "urn:pmp:hreftpl:profiles", "urn:pmp:hreftpl:schemas", "urn:pmp:query:docs", "urn:pmp:query:files", "urn:pmp:query:groups", "urn:pmp:query:guids", "urn:pmp:query:users"]
45
+ tc.query.keys.sort.must_equal ["urn:pmp:hreftpl:docs", "urn:pmp:hreftpl:profiles", "urn:pmp:hreftpl:schemas", "urn:pmp:query:docs", "urn:pmp:query:groups", "urn:pmp:query:guids", "urn:pmp:query:users"]
46
46
  end
47
47
 
48
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kuklewicz