g5_foundation_client 0.5.0.pre1 → 0.5.0.pre2

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: 2fd8b87c71782c1bb666b902a566fd777ec56211
4
- data.tar.gz: 8c8b327793af64b9e031cfefda8f3193a7d8c93c
3
+ metadata.gz: 807c8851692cd74f6c66128a7c31d077d09a564f
4
+ data.tar.gz: 22f8e6564cb638daea527810c61dde2b6f800685
5
5
  SHA512:
6
- metadata.gz: 46dce111c3476a5933898a136272ab76751df790f3b0e7343f96de988015132e0cb3ccc0f87a0b86295666a266c4c37ec77ecbcad56f9816062810efe772a2ec
7
- data.tar.gz: c5e5283416b2421247d132657a50bdc73ec2be7065ff6ee858640ab00ef2ecb429825b8ac7f81afd8dcf2c449f425dc2a588582a2a67f91a200dba8af7540e3d
6
+ metadata.gz: 325dd6d2becae939cdb339cf9eba356d23bbfe01aa258ab43d45454ecada7b03dd47a835ef91f53fc47e5923726a0ce0541af7fc8ff1841318540b8ac0c995ae
7
+ data.tar.gz: fa0b1064c38c59263b8d1b4e5076f431770995ba8f5957a853f3e66ed863c7798cbd46c0cafb3790149cde765afc8ddcb1192b441b932b44b36d8c402abf1906
@@ -0,0 +1,13 @@
1
+ module G5FoundationClient
2
+ class Group
3
+ attr_reader :attributes
4
+
5
+ def initialize(attrs)
6
+ @attributes = ActiveSupport::HashWithIndifferentAccess.new(attrs)
7
+ end
8
+
9
+ [:id, :name, :description, :urn, :core_group_id, :created_at, :updated_at].each do |field|
10
+ define_method(field) { self.attributes[field] }
11
+ end
12
+ end
13
+ end
@@ -46,7 +46,20 @@ class G5FoundationClient::Location
46
46
  "#{street_address_1}\n#{street_address_2}"
47
47
  end
48
48
 
49
+ def groups
50
+ build('groups')
51
+ end
52
+
49
53
  def amenities
50
- self.location_hash.fetch(:amenities, []).collect { |amen_hash| ::G5FoundationClient::Amenity.new(amen_hash) }
54
+ build('amenities')
55
+ end
56
+
57
+ private
58
+
59
+ def build(attributes)
60
+ self.location_hash.fetch(attributes.to_sym, []).map do |hash|
61
+ klass = "::G5FoundationClient::#{attributes.singularize.capitalize}"
62
+ klass.constantize.new(hash)
63
+ end
51
64
  end
52
65
  end
@@ -1,3 +1,3 @@
1
1
  module G5FoundationClient
2
- VERSION = '0.5.0.pre1'
2
+ VERSION = '0.5.0.pre2'
3
3
  end
@@ -21,5 +21,5 @@ require 'g5_foundation_client/models/findable_by_uid'
21
21
  require 'g5_foundation_client/models/amenity'
22
22
  require 'g5_foundation_client/models/location'
23
23
  require 'g5_foundation_client/models/client'
24
-
24
+ require 'g5_foundation_client/models/group'
25
25
 
@@ -180,8 +180,28 @@
180
180
  "created_at": "2016-11-22T09:20:16.578-08:00",
181
181
  "updated_at": "2016-11-22T09:20:16.578-08:00"
182
182
  }
183
+ ],
184
+ "groups": [
185
+ {
186
+ "id": 13,
187
+ "name": "san_diego_east_region",
188
+ "description": "East San Diego County",
189
+ "urn": "g5-g-1w28z0k5-san_diego_east_region",
190
+ "core_group_id": 13,
191
+ "created_at": "2016-12-12T11:46:58.140-08:00",
192
+ "updated_at": "2016-12-12T11:46:58.140-08:00"
193
+ },
194
+ {
195
+ "id": 549,
196
+ "name": "san_diego",
197
+ "description": "San Diego",
198
+ "urn": "g5-g-iwmhw5yt-san_diego",
199
+ "core_group_id": 550,
200
+ "created_at": "2016-12-12T11:51:38.205-08:00",
201
+ "updated_at": "2016-12-12T11:51:38.205-08:00"
202
+ }
183
203
  ]
184
204
  }
185
205
  ]
186
206
  }
187
- }
207
+ }
@@ -161,6 +161,26 @@
161
161
  "created_at": "2016-11-22T09:20:16.578-08:00",
162
162
  "updated_at": "2016-11-22T09:20:16.578-08:00"
163
163
  }
164
+ ],
165
+ "groups": [
166
+ {
167
+ "id": 13,
168
+ "name": "san_diego_east_region",
169
+ "description": "East San Diego County",
170
+ "urn": "g5-g-1w28z0k5-san_diego_east_region",
171
+ "core_group_id": 13,
172
+ "created_at": "2016-12-12T11:46:58.140-08:00",
173
+ "updated_at": "2016-12-12T11:46:58.140-08:00"
174
+ },
175
+ {
176
+ "id": 549,
177
+ "name": "san_diego",
178
+ "description": "San Diego",
179
+ "urn": "g5-g-iwmhw5yt-san_diego",
180
+ "core_group_id": 550,
181
+ "created_at": "2016-12-12T11:51:38.205-08:00",
182
+ "updated_at": "2016-12-12T11:51:38.205-08:00"
183
+ }
164
184
  ]
165
185
  }
166
- }
186
+ }
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe G5FoundationClient::Group do
4
+ let(:id) { 1 }
5
+ let(:name) { 'San Diego' }
6
+ let(:description) { 'San Diego group' }
7
+ let(:urn) { 'g5-g-san-diego' }
8
+ let(:core_group_id) { 2 }
9
+ let(:created_at) { '2016-11-22T09:20:16.549-08:00' }
10
+ let(:updated_at) { '2016-11-22T09:20:16.549-08:00' }
11
+
12
+ subject do
13
+ described_class.new({
14
+ id: id,
15
+ name: name,
16
+ description: description,
17
+ urn: urn,
18
+ core_group_id: core_group_id,
19
+ created_at: created_at,
20
+ updated_at: updated_at
21
+ })
22
+ end
23
+
24
+ its(:id) { is_expected.to eq(id) }
25
+ its(:name) { is_expected.to eq(name) }
26
+ its(:description) { is_expected.to eq(description) }
27
+ its(:urn) { is_expected.to eq(urn) }
28
+ its(:core_group_id) { is_expected.to eq(core_group_id) }
29
+ its(:created_at) { is_expected.to eq(created_at) }
30
+ its(:updated_at) { is_expected.to eq(updated_at) }
31
+ end
@@ -28,20 +28,41 @@ describe G5FoundationClient::Location do
28
28
  postal_code: "31337",
29
29
  status: "Pending",
30
30
  client: client,
31
- amenities: [{
32
- id: 1,
31
+ amenities: [
32
+ {
33
+ id: 1,
33
34
  name: "Covered Parking",
34
35
  icon: "fa fa-parking-interior",
35
36
  created_at: "2016-11-22T09:20:16.549-08:00",
36
37
  updated_at: "2016-11-22T09:20:16.549-08:00"
38
+ },
39
+ {
40
+ id: 3,
41
+ name: "WIFI",
42
+ icon: "fa fa-wifi",
43
+ created_at: "2016-11-22T09:20:16.578-08:00",
44
+ updated_at: "2016-11-22T09:20:16.578-08:00"
45
+ }
46
+ ],
47
+ groups: [
48
+ {
49
+ id: 13,
50
+ name: "san_diego_east_region",
51
+ description: "East San Diego County",
52
+ urn: "g5-g-1w28z0k5-san_diego_east_region",
53
+ core_group_id: 13,
54
+ created_at: "2016-12-12T11:46:58.140-08:00",
55
+ updated_at: "2016-12-12T11:46:58.140-08:00"
37
56
  },
38
57
  {
39
- id: 3,
40
- name: "WIFI",
41
- icon: "fa fa-wifi",
42
- created_at: "2016-11-22T09:20:16.578-08:00",
43
- updated_at: "2016-11-22T09:20:16.578-08:00"
44
- }
58
+ id: 549,
59
+ name: "san_diego",
60
+ description: "San Diego",
61
+ urn: "g5-g-iwmhw5yt-san_diego",
62
+ core_group_id: 550,
63
+ created_at: "2016-12-12T11:51:38.205-08:00",
64
+ updated_at: "2016-12-12T11:51:38.205-08:00"
65
+ }
45
66
  ]
46
67
  )
47
68
  end
@@ -73,6 +94,10 @@ describe G5FoundationClient::Location do
73
94
  it 'builds amenities' do
74
95
  expect(subject.amenities.collect(&:name)).to eq(['Covered Parking', 'WIFI'])
75
96
  end
97
+
98
+ it 'builds groups' do
99
+ expect(subject.groups.collect(&:id)).to eq([13, 549])
100
+ end
76
101
  end
77
102
 
78
103
  describe '.find_by_uid' do
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.5.0.pre1
4
+ version: 0.5.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Petersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -158,6 +158,7 @@ files:
158
158
  - lib/g5_foundation_client/models/amenity.rb
159
159
  - lib/g5_foundation_client/models/client.rb
160
160
  - lib/g5_foundation_client/models/findable_by_uid.rb
161
+ - lib/g5_foundation_client/models/group.rb
161
162
  - lib/g5_foundation_client/models/location.rb
162
163
  - lib/g5_foundation_client/record_not_found_exception.rb
163
164
  - lib/g5_foundation_client/rspec.rb
@@ -169,6 +170,7 @@ files:
169
170
  - spec/lib/g5_foundation_client/fetcher_spec.rb
170
171
  - spec/lib/g5_foundation_client/models/amenity_spec.rb
171
172
  - spec/lib/g5_foundation_client/models/client_spec.rb
173
+ - spec/lib/g5_foundation_client/models/group_spec.rb
172
174
  - spec/lib/g5_foundation_client/models/location_spec.rb
173
175
  - spec/lib/g5_foundation_client_spec.rb
174
176
  - spec/spec_helper.rb
@@ -203,6 +205,8 @@ test_files:
203
205
  - spec/lib/g5_foundation_client/fetcher_spec.rb
204
206
  - spec/lib/g5_foundation_client/models/amenity_spec.rb
205
207
  - spec/lib/g5_foundation_client/models/client_spec.rb
208
+ - spec/lib/g5_foundation_client/models/group_spec.rb
206
209
  - spec/lib/g5_foundation_client/models/location_spec.rb
207
210
  - spec/lib/g5_foundation_client_spec.rb
208
211
  - spec/spec_helper.rb
212
+ has_rdoc: