pmp 0.4.0 → 0.4.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.
@@ -67,8 +67,8 @@ describe PMP::Link do
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 "0c9eeb61-dba5-431a-be8e-ad74c64aad2b"
71
- guids.last.must_equal "e77aa925-53e0-4cfd-8f16-db6146faef3e"
70
+ guids.first.must_equal "0390510e-f1cb-4cef-b362-1e916d4c92f1"
71
+ guids.last.must_equal "f237f87d-1f40-4178-9eba-b068b5dc6f7b"
72
72
  end
73
73
 
74
74
  def query_document_info
@@ -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: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"]
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:profiles", "urn:collectiondoc:query:schemas", "urn:collectiondoc:query:users"]
58
58
  end
59
59
 
60
60
  it "will unparse links" do
@@ -8,9 +8,15 @@ require 'webmock/minitest'
8
8
 
9
9
  describe PMP::Token do
10
10
 
11
+ # stub getting the root doc
12
+ before do
13
+ root_doc = json_file(:collection_root)
14
+ stub_request(:get, 'https://api.pmp.io').to_return(:status => 200, :body => root_doc)
15
+ end
16
+
11
17
  it "gets the base path for this subclass of API" do
12
18
  token = PMP::Token.new
13
- token.token_url.must_equal '/auth/access_token'
19
+ token.token_url.must_match "/auth/access_token"
14
20
  end
15
21
 
16
22
  it "gets an access_token" do
@@ -21,18 +27,17 @@ describe PMP::Token do
21
27
  token_issue_date: DateTime.now,
22
28
  token_expires_in: 24*60*60
23
29
  }.to_json
24
-
25
- stub_request(:post, "https://api-sandbox.pmp.io/auth/access_token").
30
+
31
+ stub_request(:post, "https://api.pmp.io/auth/access_token").
26
32
  with(:body => {"grant_type"=>"client_credentials"},
27
- :headers => {'Accept'=>'application/json', 'Authorization'=>'Basic dGhpc2lzbm90YS1yZWFsLWNsaWVudC1pZC1zb3Zlcnlzb3JyeTp0aGlzaXNub3RhcmVhbHNlY3JldGVpdGhlcg==', 'Content-Type'=>'application/x-www-form-urlencoded', 'Host'=>'api-sandbox.pmp.io:443'}).
33
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'Basic dGhpc2lzbm90YS1yZWFsLWNsaWVudC1pZC1zb3Zlcnlzb3JyeTp0aGlzaXNub3RhcmVhbHNlY3JldGVpdGhlcg==', 'Content-Type'=>'application/x-www-form-urlencoded'}).
28
34
  to_return(:status => 200, :body => response_body, :headers => {'Content-Type' => 'application/json; charset=utf-8'})
29
35
 
30
36
  client_id = "thisisnota-real-client-id-soverysorry"
31
37
  client_secret = "thisisnotarealsecreteither"
32
- endpoint = "https://api-sandbox.pmp.io"
33
38
  token_path = '/auth/access_token'
34
-
35
- token_api= PMP::Token.new(client_id: client_id, client_secret: client_secret, endpoint: endpoint)
39
+
40
+ token_api= PMP::Token.new(client_id: client_id, client_secret: client_secret)
36
41
  token = token_api.get_token
37
42
  token.token.must_equal access_token
38
43
  token.params['token_type'].must_equal 'Bearer'
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.0
4
+ version: 0.4.1
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-08-11 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler