g5_foundation_client 0.3.0 → 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/lib/g5_foundation_client/fetcher.rb +3 -1
- data/lib/g5_foundation_client/version.rb +1 -1
- data/lib/g5_foundation_client.rb +7 -0
- data/spec/lib/g5_foundation_client/fetcher_spec.rb +2 -1
- data/spec/lib/g5_foundation_client/models/client_spec.rb +3 -2
- data/spec/lib/g5_foundation_client/models/location_spec.rb +2 -1
- data/spec/lib/g5_foundation_client_spec.rb +23 -0
- data/spec/spec_helper.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93cee27af8202bb383a184bd2c817d572c3071f8
|
4
|
+
data.tar.gz: e3778b073badbb1fe391415a70cb0a79bfceb86a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74998ec3fa2cbe851339f899e0da4665a609eeb35cf27f6715d40537469fbd1e3273fdb3ddc74bb96db69def8710ab654e27e4a2a9908c2bb7c5cd2f120bb06f
|
7
|
+
data.tar.gz: 181554789165c1f2e9b01872e768f9c883404656c7dd58cd7590fc61722bcb17322a3660cfa344cbc8e701d19dd6d66049db37cc02f123b8d2581204fc3085c9
|
@@ -2,7 +2,9 @@ class G5FoundationClient::Fetcher
|
|
2
2
|
def self.fetch_url(url, &block)
|
3
3
|
response = HTTParty.get(
|
4
4
|
url,
|
5
|
-
|
5
|
+
{query: {access_token: G5FoundationClient::access_token},
|
6
|
+
headers: {'Content-Type' => 'application/json', 'Accept' => 'application/json'}
|
7
|
+
}
|
6
8
|
)
|
7
9
|
|
8
10
|
case response.response.code.to_i
|
data/lib/g5_foundation_client.rb
CHANGED
@@ -4,6 +4,13 @@ require 'g5_authentication_client'
|
|
4
4
|
require 'g5_foundation_client/version'
|
5
5
|
|
6
6
|
module G5FoundationClient
|
7
|
+
def self.access_token=(token)
|
8
|
+
@access_token = token
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.access_token
|
12
|
+
@access_token ||= G5AuthenticationClient::Client.new.get_access_token
|
13
|
+
end
|
7
14
|
end
|
8
15
|
|
9
16
|
require 'g5_foundation_client/error'
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe G5FoundationClient::Fetcher do
|
4
|
+
before { G5FoundationClient.access_token = "token" }
|
4
5
|
|
5
6
|
describe ".fetch_url" do
|
6
|
-
let(:url) { "http://example.com
|
7
|
+
let(:url) { "http://example.com/?access_token=token" }
|
7
8
|
subject(:fetch) do
|
8
9
|
yielded_markup = nil
|
9
10
|
G5FoundationClient::Fetcher.fetch_url(url) do |markup|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe G5FoundationClient::Client do
|
4
|
+
before { G5FoundationClient.access_token = "token" }
|
4
5
|
|
5
6
|
describe "instantiating with a hash" do
|
6
7
|
subject do
|
@@ -49,7 +50,7 @@ describe G5FoundationClient::Client do
|
|
49
50
|
describe :all_client_uids do
|
50
51
|
let(:clients_url) { 'http://the-hub-clients-url' }
|
51
52
|
let(:response) { fixture('hub-clients.json') }
|
52
|
-
before { stub_json(clients_url, response) }
|
53
|
+
before { stub_json(clients_url + '?access_token=token', response) }
|
53
54
|
subject(:all_client_uids) { G5FoundationClient::Client.all_client_uids(clients_url) }
|
54
55
|
let(:expected) do
|
55
56
|
%w(http://hub.g5dxm.com/clients/g5-c-1sshwrc5-chateau-retirement-communities-llc http://hub.g5dxm.com/clients/g5-c-1skckws2-case-and-associates-properties-inc http://hub.g5dxm.com/clients/g5-c-1sjhz1kl-holland-residential http://hub.g5dxm.com/clients/g5-c-1szcnbet-berkshire-communities http://hub.g5dxm.com/clients/g5-c-1soj8z7v-g5-selfstorage http://hub.g5dxm.com/clients/g5-c-1suhzvye-demo-client-senior-living http://hub.g5dxm.com/clients/g5-c-1t08o5vy-default-yaml-test http://hub.g5dxm.com/clients/g5-c-1szs3551-passco-companies-llc http://hub.g5dxm.com/clients/g5-c-1sze0wlk-legacy-ptla http://hub.g5dxm.com/clients/g5-c-1szn2ho0-spinup-test-4 http://hub.g5dxm.com/clients/g5-c-1stn8mua-blue-ridge-companies http://hub.g5dxm.com/clients/g5-c-1soj8m6e-g5-multifamily http://hub.g5dxm.com/clients/g5-c-1szcsfqz-animal-farm http://hub.g5dxm.com/clients/g5-c-6d4gqkl-demo http://hub.g5dxm.com/clients/g5-c-1skmeepf-clowns-monkeys-jokers http://hub.g5dxm.com/clients/g5-c-1slhp2tc-compass-rock-real-estate http://hub.g5dxm.com/clients/g5-c-1svnc06g-deploy-test http://hub.g5dxm.com/clients/g5-c-1sve69nj-brian-url-test http://hub.g5dxm.com/clients/g5-c-1su8sbx5-brian-reader-test http://hub.g5dxm.com/clients/g5-c-1su76sgw-brian-test-cms http://hub.g5dxm.com/clients/g5-c-1strrmif-cke-properties http://hub.g5dxm.com/clients/g5-c-1sojmghc-g5-multifamily2 http://hub.g5dxm.com/clients/g5-c-1so8p6u9-mj-storage http://hub.g5dxm.com/clients/g5-c-1sbdk8wp-bb-self-storage http://hub.g5dxm.com/clients/g5-c-1sf7t8z8-jls-single-domain-client http://hub.g5dxm.com/clients/g5-c-1servrzr-luxe-apartment-company http://hub.g5dxm.com/clients/g5-c-6d4u4sc-madrona http://hub.g5dxm.com/clients/g5-c-1sbmayxa-bb-properties http://hub.g5dxm.com/clients/g5-c-1s9v57wo-jls-inc http://hub.g5dxm.com/clients/g5-c-1s3t3hh2-omni-consumer-products)
|
@@ -62,7 +63,7 @@ describe G5FoundationClient::Client do
|
|
62
63
|
describe ".find_by_uid" do
|
63
64
|
let(:uid) { 'http://example.com/clients/g5-c-1234-client' }
|
64
65
|
let(:response) { fixture('hub-client.json') }
|
65
|
-
before { stub_json(uid, response) }
|
66
|
+
before { stub_json(uid + '?access_token=token', response) }
|
66
67
|
subject(:find) { G5FoundationClient::Client.find_by_uid(uid) }
|
67
68
|
|
68
69
|
its(:name) { should eq('no store') }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe G5FoundationClient::Location do
|
4
|
+
before { G5FoundationClient.access_token = "token" }
|
4
5
|
|
5
6
|
describe "instantiating with a hash" do
|
6
7
|
let(:client) { G5FoundationClient::Client.new(uid: 'myclient') }
|
@@ -60,7 +61,7 @@ describe G5FoundationClient::Location do
|
|
60
61
|
'http://example.com/clients/g5-c-1234-client/locations/g5-cl-1234-location'
|
61
62
|
end
|
62
63
|
let(:response) { fixture('hub-location.json') }
|
63
|
-
before { stub_json(uid, response) }
|
64
|
+
before { stub_json(uid + '?access_token=token', response) }
|
64
65
|
subject(:find) { G5FoundationClient::Location.find_by_uid(uid) }
|
65
66
|
|
66
67
|
its(:name) { should eq('brussels') }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe G5FoundationClient do
|
4
|
+
describe ".access_token" do
|
5
|
+
subject { G5FoundationClient.access_token }
|
6
|
+
|
7
|
+
context "when it has not been set" do
|
8
|
+
before do
|
9
|
+
G5AuthenticationClient::Client.stub_chain(
|
10
|
+
:new,
|
11
|
+
get_access_token: "fetched access token"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
it { should eql("fetched access token") }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when it has beeen set" do
|
19
|
+
before { G5FoundationClient.access_token = "set access token" }
|
20
|
+
it { should eql("set access token") }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_foundation_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Petersen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- spec/lib/g5_foundation_client/fetcher_spec.rb
|
155
155
|
- spec/lib/g5_foundation_client/models/client_spec.rb
|
156
156
|
- spec/lib/g5_foundation_client/models/location_spec.rb
|
157
|
+
- spec/lib/g5_foundation_client_spec.rb
|
157
158
|
- spec/spec_helper.rb
|
158
159
|
homepage: https://github.com/g5/g5_foundation_client
|
159
160
|
licenses:
|
@@ -186,4 +187,5 @@ test_files:
|
|
186
187
|
- spec/lib/g5_foundation_client/fetcher_spec.rb
|
187
188
|
- spec/lib/g5_foundation_client/models/client_spec.rb
|
188
189
|
- spec/lib/g5_foundation_client/models/location_spec.rb
|
190
|
+
- spec/lib/g5_foundation_client_spec.rb
|
189
191
|
- spec/spec_helper.rb
|