pmp 0.2.4 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e20dca7592de10022ded2bda390f2e172bc8f026
4
- data.tar.gz: 704f4900aa8ebcb8af896682a2f3ed743f669fc0
3
+ metadata.gz: 7e7ac8db962f9e688afb289a6e61e0fa61775ffa
4
+ data.tar.gz: a20438ab58d2336b6f925f22e1813310a0bb01be
5
5
  SHA512:
6
- metadata.gz: c01ba49f3108680b8353355de2a5e4c4a646816e82a699bb00f0895e7513e074582e5ad3615f96545fb91923a7041e75c5c457cadffd5c3ee18d63d1ddf452df
7
- data.tar.gz: ebb7db14d83f8b167c12df7552b5c662d635e0fe95e43e0e4321a4b3aaabec9c5012a87aa8f488b37172fbc6acb2bf0b4d01c019251058e62805e8fa13ddd8da
6
+ metadata.gz: 92996e6770ba266693cad6d941a8423882772d99b6e49fbee7b24c3930f8cf4da829581741118eaa3afc48b5441858a78b40d4717be0b81c2d153258584fc2e9
7
+ data.tar.gz: 934228fc26f99102bb61dae5e2ca6a4d97d184d0dcb9b1b65bf738652a53fb515265eba1a5fe69d8dd7cc53e0775509f73f1b1ebc22e57fe5c9290e5e3c675f0
data/lib/pmp/parser.rb CHANGED
@@ -75,8 +75,8 @@ module PMP
75
75
  parse_links_list(info)
76
76
  elsif !info.is_a?(Array)
77
77
  Link.new(info)
78
- elsif info.size == 1
79
- Link.new(info.first)
78
+ # elsif info.size == 1
79
+ # Link.new(info.first)
80
80
  elsif info.size > 0
81
81
  info.map{|l| Link.new(l)}
82
82
  end
data/lib/pmp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module PMP
4
- VERSION = "0.2.4"
4
+ VERSION = "0.3.0"
5
5
  end
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 Og==', 'Content-Type'=>'application/x-www-form-urlencoded', 'Host'=>'api.pmp.io:443'}).
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.2.4
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: 2013-10-25 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler