g5_updatable 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -34
- data/app/concerns/g5_updatable/belongs_to_location.rb +14 -0
- data/app/concerns/g5_updatable/first_class_properties.rb +25 -0
- data/app/concerns/g5_updatable/urn_as_parameter.rb +7 -0
- data/app/controllers/g5_updatable/feed_controller.rb +1 -1
- data/app/models/g5_updatable/client.rb +12 -0
- data/app/models/g5_updatable/integration_setting.rb +20 -0
- data/app/models/g5_updatable/location.rb +16 -0
- data/app/serializers/g5_updatable/location_serializer.rb +12 -0
- data/db/migrate/20140709222005_create_g5_updatable_clients_and_locations.rb +24 -0
- data/db/migrate/20141030211945_create_integration_setting.rb +18 -0
- data/lib/g5_updatable/client_feed_processor.rb +34 -12
- data/lib/g5_updatable/client_updater.rb +7 -16
- data/lib/g5_updatable/engine.rb +2 -13
- data/lib/g5_updatable/integration_settings_updater.rb +21 -0
- data/lib/g5_updatable/locations_updater.rb +14 -21
- data/lib/g5_updatable/rspec/factories.rb +19 -0
- data/lib/g5_updatable/rspec.rb +3 -0
- data/lib/g5_updatable/version.rb +1 -1
- data/lib/g5_updatable.rb +2 -1
- data/lib/generators/g5_updatable/install/USAGE +0 -3
- data/lib/generators/g5_updatable/install/install_generator.rb +0 -6
- data/lib/tasks/g5_updatable_tasks.rake +12 -4
- data/spec/concerns/g5_updatable/belongs_to_location_spec.rb +30 -0
- data/spec/dummy/app/models/favorite_food.rb +3 -0
- data/spec/dummy/config/database.sample.yml +9 -0
- data/spec/dummy/config/database.travis.yml +4 -0
- data/spec/dummy/db/migrate/20140709220627_drop_clients_and_locations.rb +10 -0
- data/spec/dummy/db/migrate/20140714225203_create_favorite_foods.rb +10 -0
- data/spec/dummy/db/schema.rb +39 -21
- data/spec/dummy/log/test.log +18589 -920
- data/spec/lib/g5_updatable/client_feed_processor_spec.rb +77 -22
- data/spec/lib/g5_updatable/client_updater_spec.rb +28 -41
- data/spec/lib/g5_updatable/integration_settings_updater_spec.rb +48 -0
- data/spec/lib/g5_updatable/locations_updater_spec.rb +29 -52
- data/spec/lib/generators/g5_updatable/install_generator_spec.rb +0 -12
- data/spec/models/g5_updatable/client_spec.rb +25 -0
- data/spec/models/g5_updatable/integration_setting_spec.rb +33 -0
- data/spec/models/g5_updatable/location_spec.rb +34 -0
- data/spec/serializers/g5_updatable/location_serializer_spec.rb +21 -0
- data/spec/spec_helper.rb +13 -5
- data/spec/support/shared_example_for_urn_as_parameter.rb +7 -0
- data/spec/support/shared_examples_for_first_class_properties_json.rb +29 -0
- metadata +104 -42
- data/lib/g5_updatable/feed_mapper.rb +0 -58
- data/lib/g5_updatable/g5_client.rb +0 -10
- data/lib/g5_updatable/g5_location.rb +0 -22
- data/lib/generators/g5_updatable/install/templates/g5_updatable.rb +0 -25
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/initializers/g5_updatable.rb +0 -4
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -6434
- data/spec/dummy/spec/fabricators/client_fabricator.rb +0 -6
- data/spec/dummy/spec/fabricators/location_fabricator.rb +0 -9
- data/spec/dummy/spec/models/client_spec.rb +0 -0
- data/spec/dummy/spec/models/location_spec.rb +0 -0
- data/spec/dummy/spec/support/client_feed.html +0 -97
- data/spec/dummy/spec/support/updated_client_feed.html +0 -148
- data/spec/fabricators/client_fabricator.rb +0 -6
- data/spec/fabricators/location_fabricator.rb +0 -9
- data/spec/lib/g5_updatable/feed_mapper_spec.rb +0 -119
- data/spec/lib/tmp/config/initializers/g5_updatable.rb +0 -25
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe G5Updatable::LocationSerializer do
|
4
|
+
let(:location) do
|
5
|
+
FactoryGirl.build(
|
6
|
+
:location,
|
7
|
+
uid: "https://example.com/locations/test-urn",
|
8
|
+
urn: "test-urn",
|
9
|
+
client_uid: "https://example.com/client",
|
10
|
+
properties: {
|
11
|
+
name: "Test Name"
|
12
|
+
}
|
13
|
+
)
|
14
|
+
end
|
15
|
+
subject { G5Updatable::LocationSerializer.new(location).as_json["location"] }
|
16
|
+
|
17
|
+
its([:uid]) { is_expected.to eq("https://example.com/locations/test-urn") }
|
18
|
+
its([:urn]) { is_expected.to eq("test-urn") }
|
19
|
+
its([:client_uid]) { is_expected.to eq("https://example.com/client") }
|
20
|
+
its([:name]) { is_expected.to eq("Test Name") }
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,28 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
ENV["RAILS_ENV"] ||= 'test'
|
3
3
|
|
4
|
-
require File.expand_path("../dummy/config/environment.rb",
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
5
|
require 'rspec/rails'
|
6
|
+
require 'rspec/its'
|
7
|
+
|
8
|
+
require 'generator_spec'
|
9
|
+
require 'factory_girl'
|
10
|
+
require 'g5_updatable/rspec'
|
11
|
+
require 'shoulda/matchers'
|
12
|
+
require 'g5_foundation_client/rspec'
|
6
13
|
|
7
14
|
Rails.backtrace_cleaner.remove_silencers!
|
8
15
|
|
9
16
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
17
|
# in spec/support/ and its subdirectories.
|
11
|
-
Dir[
|
18
|
+
Dir[G5Updatable::Engine.root.join("spec/support/**/*.rb")].each { |f| require f }
|
12
19
|
|
13
20
|
# Checks for pending migrations before tests are run.
|
14
21
|
# If you are not using ActiveRecord, you can remove this line.
|
15
22
|
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
16
23
|
|
17
24
|
RSpec.configure do |config|
|
25
|
+
config.include FactoryGirl::Syntax::Methods
|
18
26
|
# ## Mock Framework
|
19
27
|
#
|
20
28
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
@@ -24,12 +32,12 @@ RSpec.configure do |config|
|
|
24
32
|
# config.mock_with :rr
|
25
33
|
|
26
34
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
27
|
-
config.fixture_path
|
35
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
28
36
|
|
29
37
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
30
38
|
# examples within a transaction, remove the following line or assign false
|
31
39
|
# instead of true.
|
32
|
-
config.use_transactional_fixtures
|
40
|
+
config.use_transactional_fixtures = true
|
33
41
|
|
34
42
|
# If true, the base class of anonymous controllers will be inferred
|
35
43
|
# automatically. This will be the default behavior in future versions of
|
@@ -40,5 +48,5 @@ RSpec.configure do |config|
|
|
40
48
|
# order dependency and want to debug it, you can fix the order by providing
|
41
49
|
# the seed, which is printed after each run.
|
42
50
|
# --seed 1234
|
43
|
-
config.order
|
51
|
+
config.order = "random"
|
44
52
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
shared_examples_for "a model with first-class properties" do
|
2
|
+
describe "properties" do
|
3
|
+
let(:instance) { FactoryGirl.build(instance_factory_name, properties: { key: "value" }) }
|
4
|
+
|
5
|
+
context "when properties are on an instance from the database" do
|
6
|
+
before do
|
7
|
+
instance.save!
|
8
|
+
end
|
9
|
+
subject { instance.class.find(instance.id) }
|
10
|
+
|
11
|
+
its(:key) { should eq("value") }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when properties were set on an in-memory instance" do
|
15
|
+
context "trying to access an existing property" do
|
16
|
+
subject { instance.key }
|
17
|
+
it { should eq("value") }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "trying to access an nonexistent property" do
|
21
|
+
subject { instance.bad }
|
22
|
+
|
23
|
+
it "blows up normally" do
|
24
|
+
expect { subject }.to raise_error(NoMethodError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_updatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Bauer
|
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: rails
|
@@ -16,30 +16,30 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1.
|
19
|
+
version: 4.1.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1.
|
26
|
+
version: 4.1.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: g5_foundation_client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pg
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,13 +53,27 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: active_model_serializers
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: virtus
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
|
-
type: :
|
76
|
+
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
@@ -80,6 +94,48 @@ dependencies:
|
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-its
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_girl
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: generator_spec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
83
139
|
description: Client/Locations data update engine for G5 applications
|
84
140
|
email:
|
85
141
|
- brian.bauer@getg5.com
|
@@ -92,24 +148,33 @@ files:
|
|
92
148
|
- Rakefile
|
93
149
|
- app/assets/javascripts/g5_updatable/application.js
|
94
150
|
- app/assets/stylesheets/g5_updatable/application.css
|
151
|
+
- app/concerns/g5_updatable/belongs_to_location.rb
|
152
|
+
- app/concerns/g5_updatable/first_class_properties.rb
|
153
|
+
- app/concerns/g5_updatable/urn_as_parameter.rb
|
95
154
|
- app/controllers/g5_updatable/application_controller.rb
|
96
155
|
- app/controllers/g5_updatable/feed_controller.rb
|
97
156
|
- app/helpers/g5_updatable/application_helper.rb
|
157
|
+
- app/models/g5_updatable/client.rb
|
158
|
+
- app/models/g5_updatable/integration_setting.rb
|
159
|
+
- app/models/g5_updatable/location.rb
|
160
|
+
- app/serializers/g5_updatable/location_serializer.rb
|
98
161
|
- app/views/layouts/g5_updatable/application.html.erb
|
99
162
|
- config/routes.rb
|
163
|
+
- db/migrate/20140709222005_create_g5_updatable_clients_and_locations.rb
|
164
|
+
- db/migrate/20141030211945_create_integration_setting.rb
|
100
165
|
- lib/g5_updatable.rb
|
101
166
|
- lib/g5_updatable/client_feed_processor.rb
|
102
167
|
- lib/g5_updatable/client_updater.rb
|
103
168
|
- lib/g5_updatable/engine.rb
|
104
|
-
- lib/g5_updatable/
|
105
|
-
- lib/g5_updatable/g5_client.rb
|
106
|
-
- lib/g5_updatable/g5_location.rb
|
169
|
+
- lib/g5_updatable/integration_settings_updater.rb
|
107
170
|
- lib/g5_updatable/locations_updater.rb
|
171
|
+
- lib/g5_updatable/rspec.rb
|
172
|
+
- lib/g5_updatable/rspec/factories.rb
|
108
173
|
- lib/g5_updatable/version.rb
|
109
174
|
- lib/generators/g5_updatable/install/USAGE
|
110
175
|
- lib/generators/g5_updatable/install/install_generator.rb
|
111
|
-
- lib/generators/g5_updatable/install/templates/g5_updatable.rb
|
112
176
|
- lib/tasks/g5_updatable_tasks.rake
|
177
|
+
- spec/concerns/g5_updatable/belongs_to_location_spec.rb
|
113
178
|
- spec/dummy/README.rdoc
|
114
179
|
- spec/dummy/Rakefile
|
115
180
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -117,6 +182,7 @@ files:
|
|
117
182
|
- spec/dummy/app/controllers/application_controller.rb
|
118
183
|
- spec/dummy/app/helpers/application_helper.rb
|
119
184
|
- spec/dummy/app/models/client.rb
|
185
|
+
- spec/dummy/app/models/favorite_food.rb
|
120
186
|
- spec/dummy/app/models/location.rb
|
121
187
|
- spec/dummy/app/views/layouts/application.html.erb
|
122
188
|
- spec/dummy/bin/bundle
|
@@ -125,7 +191,8 @@ files:
|
|
125
191
|
- spec/dummy/config.ru
|
126
192
|
- spec/dummy/config/application.rb
|
127
193
|
- spec/dummy/config/boot.rb
|
128
|
-
- spec/dummy/config/database.yml
|
194
|
+
- spec/dummy/config/database.sample.yml
|
195
|
+
- spec/dummy/config/database.travis.yml
|
129
196
|
- spec/dummy/config/environment.rb
|
130
197
|
- spec/dummy/config/environments/development.rb
|
131
198
|
- spec/dummy/config/environments/production.rb
|
@@ -134,7 +201,6 @@ files:
|
|
134
201
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
135
202
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
136
203
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
137
|
-
- spec/dummy/config/initializers/g5_updatable.rb
|
138
204
|
- spec/dummy/config/initializers/inflections.rb
|
139
205
|
- spec/dummy/config/initializers/mime_types.rb
|
140
206
|
- spec/dummy/config/initializers/session_store.rb
|
@@ -142,36 +208,33 @@ files:
|
|
142
208
|
- spec/dummy/config/locales/en.yml
|
143
209
|
- spec/dummy/config/routes.rb
|
144
210
|
- spec/dummy/config/secrets.yml
|
145
|
-
- spec/dummy/db/development.sqlite3
|
146
211
|
- spec/dummy/db/migrate/20140630175259_create_locations.rb
|
147
212
|
- spec/dummy/db/migrate/20140630175330_create_clients.rb
|
213
|
+
- spec/dummy/db/migrate/20140709220627_drop_clients_and_locations.rb
|
214
|
+
- spec/dummy/db/migrate/20140714225203_create_favorite_foods.rb
|
148
215
|
- spec/dummy/db/schema.rb
|
149
216
|
- spec/dummy/db/test.sqlite3
|
150
|
-
- spec/dummy/log/development.log
|
151
217
|
- spec/dummy/log/test.log
|
152
218
|
- spec/dummy/public/404.html
|
153
219
|
- spec/dummy/public/422.html
|
154
220
|
- spec/dummy/public/500.html
|
155
221
|
- spec/dummy/public/favicon.ico
|
156
|
-
- spec/dummy/spec/fabricators/client_fabricator.rb
|
157
|
-
- spec/dummy/spec/fabricators/location_fabricator.rb
|
158
|
-
- spec/dummy/spec/models/client_spec.rb
|
159
|
-
- spec/dummy/spec/models/location_spec.rb
|
160
|
-
- spec/dummy/spec/support/client_feed.html
|
161
|
-
- spec/dummy/spec/support/updated_client_feed.html
|
162
222
|
- spec/dummy/tmp/pids/server.pid
|
163
|
-
- spec/fabricators/client_fabricator.rb
|
164
|
-
- spec/fabricators/location_fabricator.rb
|
165
223
|
- spec/lib/g5_updatable/client_feed_processor_spec.rb
|
166
224
|
- spec/lib/g5_updatable/client_updater_spec.rb
|
167
|
-
- spec/lib/g5_updatable/
|
225
|
+
- spec/lib/g5_updatable/integration_settings_updater_spec.rb
|
168
226
|
- spec/lib/g5_updatable/locations_updater_spec.rb
|
169
227
|
- spec/lib/g5_updatable/version.rb
|
170
228
|
- spec/lib/generators/g5_updatable/install_generator_spec.rb
|
171
229
|
- spec/lib/generators/tmp/config/routes.rb
|
172
|
-
- spec/lib/tmp/config/initializers/g5_updatable.rb
|
173
230
|
- spec/lib/tmp/config/routes.rb
|
231
|
+
- spec/models/g5_updatable/client_spec.rb
|
232
|
+
- spec/models/g5_updatable/integration_setting_spec.rb
|
233
|
+
- spec/models/g5_updatable/location_spec.rb
|
234
|
+
- spec/serializers/g5_updatable/location_serializer_spec.rb
|
174
235
|
- spec/spec_helper.rb
|
236
|
+
- spec/support/shared_example_for_urn_as_parameter.rb
|
237
|
+
- spec/support/shared_examples_for_first_class_properties_json.rb
|
175
238
|
homepage: https://github.com/G5/g5_updatable
|
176
239
|
licenses:
|
177
240
|
- MIT
|
@@ -197,11 +260,13 @@ signing_key:
|
|
197
260
|
specification_version: 4
|
198
261
|
summary: Client/Locations data update engine for G5 applications
|
199
262
|
test_files:
|
263
|
+
- spec/concerns/g5_updatable/belongs_to_location_spec.rb
|
200
264
|
- spec/dummy/app/assets/javascripts/application.js
|
201
265
|
- spec/dummy/app/assets/stylesheets/application.css
|
202
266
|
- spec/dummy/app/controllers/application_controller.rb
|
203
267
|
- spec/dummy/app/helpers/application_helper.rb
|
204
268
|
- spec/dummy/app/models/client.rb
|
269
|
+
- spec/dummy/app/models/favorite_food.rb
|
205
270
|
- spec/dummy/app/models/location.rb
|
206
271
|
- spec/dummy/app/views/layouts/application.html.erb
|
207
272
|
- spec/dummy/bin/bundle
|
@@ -209,7 +274,8 @@ test_files:
|
|
209
274
|
- spec/dummy/bin/rake
|
210
275
|
- spec/dummy/config/application.rb
|
211
276
|
- spec/dummy/config/boot.rb
|
212
|
-
- spec/dummy/config/database.yml
|
277
|
+
- spec/dummy/config/database.sample.yml
|
278
|
+
- spec/dummy/config/database.travis.yml
|
213
279
|
- spec/dummy/config/environment.rb
|
214
280
|
- spec/dummy/config/environments/development.rb
|
215
281
|
- spec/dummy/config/environments/production.rb
|
@@ -218,7 +284,6 @@ test_files:
|
|
218
284
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
219
285
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
220
286
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
221
|
-
- spec/dummy/config/initializers/g5_updatable.rb
|
222
287
|
- spec/dummy/config/initializers/inflections.rb
|
223
288
|
- spec/dummy/config/initializers/mime_types.rb
|
224
289
|
- spec/dummy/config/initializers/session_store.rb
|
@@ -227,12 +292,12 @@ test_files:
|
|
227
292
|
- spec/dummy/config/routes.rb
|
228
293
|
- spec/dummy/config/secrets.yml
|
229
294
|
- spec/dummy/config.ru
|
230
|
-
- spec/dummy/db/development.sqlite3
|
231
295
|
- spec/dummy/db/migrate/20140630175259_create_locations.rb
|
232
296
|
- spec/dummy/db/migrate/20140630175330_create_clients.rb
|
297
|
+
- spec/dummy/db/migrate/20140709220627_drop_clients_and_locations.rb
|
298
|
+
- spec/dummy/db/migrate/20140714225203_create_favorite_foods.rb
|
233
299
|
- spec/dummy/db/schema.rb
|
234
300
|
- spec/dummy/db/test.sqlite3
|
235
|
-
- spec/dummy/log/development.log
|
236
301
|
- spec/dummy/log/test.log
|
237
302
|
- spec/dummy/public/404.html
|
238
303
|
- spec/dummy/public/422.html
|
@@ -240,22 +305,19 @@ test_files:
|
|
240
305
|
- spec/dummy/public/favicon.ico
|
241
306
|
- spec/dummy/Rakefile
|
242
307
|
- spec/dummy/README.rdoc
|
243
|
-
- spec/dummy/spec/fabricators/client_fabricator.rb
|
244
|
-
- spec/dummy/spec/fabricators/location_fabricator.rb
|
245
|
-
- spec/dummy/spec/models/client_spec.rb
|
246
|
-
- spec/dummy/spec/models/location_spec.rb
|
247
|
-
- spec/dummy/spec/support/client_feed.html
|
248
|
-
- spec/dummy/spec/support/updated_client_feed.html
|
249
308
|
- spec/dummy/tmp/pids/server.pid
|
250
|
-
- spec/fabricators/client_fabricator.rb
|
251
|
-
- spec/fabricators/location_fabricator.rb
|
252
309
|
- spec/lib/g5_updatable/client_feed_processor_spec.rb
|
253
310
|
- spec/lib/g5_updatable/client_updater_spec.rb
|
254
|
-
- spec/lib/g5_updatable/
|
311
|
+
- spec/lib/g5_updatable/integration_settings_updater_spec.rb
|
255
312
|
- spec/lib/g5_updatable/locations_updater_spec.rb
|
256
313
|
- spec/lib/g5_updatable/version.rb
|
257
314
|
- spec/lib/generators/g5_updatable/install_generator_spec.rb
|
258
315
|
- spec/lib/generators/tmp/config/routes.rb
|
259
|
-
- spec/lib/tmp/config/initializers/g5_updatable.rb
|
260
316
|
- spec/lib/tmp/config/routes.rb
|
317
|
+
- spec/models/g5_updatable/client_spec.rb
|
318
|
+
- spec/models/g5_updatable/integration_setting_spec.rb
|
319
|
+
- spec/models/g5_updatable/location_spec.rb
|
320
|
+
- spec/serializers/g5_updatable/location_serializer_spec.rb
|
261
321
|
- spec/spec_helper.rb
|
322
|
+
- spec/support/shared_example_for_urn_as_parameter.rb
|
323
|
+
- spec/support/shared_examples_for_first_class_properties_json.rb
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require "g5_updatable/g5_client"
|
2
|
-
require "g5_updatable/g5_location"
|
3
|
-
require "microformats2"
|
4
|
-
|
5
|
-
class G5Updatable::FeedMapper
|
6
|
-
def initialize(urn)
|
7
|
-
@urn = urn
|
8
|
-
@feed = Microformats2.parse(client_uid).first if @urn
|
9
|
-
end
|
10
|
-
|
11
|
-
def client
|
12
|
-
G5Updatable::G5Client.new(client_parameters) if @feed
|
13
|
-
end
|
14
|
-
|
15
|
-
def locations
|
16
|
-
return [] if @feed.blank?
|
17
|
-
|
18
|
-
@feed.orgs.map do |location|
|
19
|
-
G5Updatable::G5Location.new(location_parameters(location.format))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def client_uid
|
26
|
-
"#{G5Updatable.feed_endpoint}#{@urn}" if @urn.present?
|
27
|
-
end
|
28
|
-
|
29
|
-
def client_parameters
|
30
|
-
{
|
31
|
-
name: @feed.name.to_s,
|
32
|
-
vertical: @feed.g5_vertical.to_s,
|
33
|
-
domain: @feed.g5_domain.to_s,
|
34
|
-
type: @feed.g5_domain_type.to_s
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
def location_parameters(location)
|
39
|
-
{
|
40
|
-
uid: location.uid.to_s,
|
41
|
-
urn: location.uid.to_s.split("/").last,
|
42
|
-
name: location.name.to_s,
|
43
|
-
domain: location.g5_domain.to_s,
|
44
|
-
street_address: location.adr.try(:format).try(:street_address).to_s,
|
45
|
-
state: location.adr.try(:format).try(:region).to_s,
|
46
|
-
city: location.adr.try(:format).try(:locality).to_s,
|
47
|
-
neighborhood: location.adr.try(:format).try(:g5_neighborhood).to_s,
|
48
|
-
postal_code: location.adr.try(:format).try(:postal_code).to_s,
|
49
|
-
phone_number: location.adr.try(:format).try(:tel).to_s,
|
50
|
-
default_number: location.adr.try(:format).try(:tel).to_s,
|
51
|
-
corporate: location.g5_corporate.to_s,
|
52
|
-
floor_plans: location.g5_floorplan.to_s,
|
53
|
-
primary_amenity: location.g5_aparment_amenity_1.to_s,
|
54
|
-
qualifier: location.g5_aparment_feature_1.to_s,
|
55
|
-
primary_landmark: location.g5_landmark_1.to_s
|
56
|
-
}
|
57
|
-
end
|
58
|
-
end
|