g5_foundation_client 0.0.15 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89fd81b1c2f7bd2bd6050a7d280e4d9a47a7d695
|
4
|
+
data.tar.gz: a35cd6b9c7a5db3a07e48a08e92e8052f6ee2b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 344c19c29daba8ad5ecac811cf364f27ca53f0a60ae28403feef35c262f11d29a9b2531015237871c6c5273b6132134879419d799fc55857a6c711e30ec85a24
|
7
|
+
data.tar.gz: 2fe403121d16365fc9a89dc93ed0b31cdff35d4c4071de7bedf3fb8f82f4a2af70e63bc8ba7bf585cb5cf56acfe69ce1639d2e563f2737a67f8812026ef47bf4
|
@@ -6,6 +6,15 @@ class G5FoundationClient::Client
|
|
6
6
|
self.client_hash = ActiveSupport::HashWithIndifferentAccess.new attrs.fetch(:client, attrs)
|
7
7
|
end
|
8
8
|
|
9
|
+
class << self
|
10
|
+
def all_client_uids(clients_uri)
|
11
|
+
G5FoundationClient::Fetcher.fetch_url(clients_uri) do |json|
|
12
|
+
hash = ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(json))
|
13
|
+
hash[:clients].collect { |client| client[:uid] }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
[:id, :uid, :name, :urn, :vertical, :street_address_1, :street_address_2,
|
10
19
|
:city, :state, :postal_code, :fax, :email, :tel, :domain_type, :domain].each do |field|
|
11
20
|
define_method(field) { self.client_hash[field] }
|
@@ -6,12 +6,12 @@ describe G5FoundationClient::Client do
|
|
6
6
|
describe "instantiating with a hash" do
|
7
7
|
subject do
|
8
8
|
G5FoundationClient::Client.new(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
uid: "http://example.com/urn",
|
10
|
+
urn: "urn",
|
11
|
+
name: "Test Name",
|
12
|
+
vertical: "Senior",
|
13
|
+
domain: "example.com",
|
14
|
+
domain_type: "MultiDomainClient"
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
@@ -29,11 +29,11 @@ describe G5FoundationClient::Client do
|
|
29
29
|
context "when the nested parameters are correct" do
|
30
30
|
let(:attributes) do
|
31
31
|
{
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
name: "Client Name",
|
33
|
+
locations: [
|
34
|
+
{name: "Location 1"},
|
35
|
+
{name: "Location 2"}
|
36
|
+
]
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -42,11 +42,24 @@ describe G5FoundationClient::Client do
|
|
42
42
|
it "instantiates associated Locations" do
|
43
43
|
expect(client.locations.length).to eq(2)
|
44
44
|
expect(client.locations.all? { |l| l.is_a?(G5FoundationClient::Location) }).to be_true
|
45
|
-
expect(client.locations.map(&:name)).to eq([
|
45
|
+
expect(client.locations.map(&:name)).to eq(['Location 1', 'Location 2'])
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
describe :all_client_uids do
|
51
|
+
let(:clients_url) { 'http://the-hub-clients-url' }
|
52
|
+
let(:response) { fixture('hub-clients.json') }
|
53
|
+
before { stub_json(clients_url + '?access_token=token', response) }
|
54
|
+
subject(:all_client_uids) { G5FoundationClient::Client.all_client_uids(clients_url) }
|
55
|
+
let(:expected) do
|
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)
|
57
|
+
end
|
58
|
+
it 'returns client_uids' do
|
59
|
+
expect(subject.sort).to eq(expected.sort)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
50
63
|
describe ".find_by_uid" do
|
51
64
|
let(:uid) { 'http://example.com/clients/g5-c-1234-client' }
|
52
65
|
let(:response) { fixture('hub-client.json') }
|
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.0
|
4
|
+
version: 0.1.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: 2014-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|