g5_integrations_updatable 0.0.4 → 0.0.5
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/README.md +24 -8
- data/app/concerns/g5_integrations_updatable/find_or_create_from_feed.rb +1 -1
- data/app/models/g5_integrations_updatable/location_setting.rb +7 -5
- data/app/serializers/g5_integrations_updatable/location_setting_serializer.rb +1 -1
- data/db/migrate/20141201204321_add_vendor_strategy_to_location_settings.rb +13 -0
- data/lib/g5_integrations_updatable/rspec/factories.rb +7 -3
- data/lib/g5_integrations_updatable/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1176226737a2c0a538e6c503dd32d8c4da191722
|
4
|
+
data.tar.gz: eb74ec108b48fe2ebe87101f8b0d9118921166e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: debd751c530d4a020069194c347dc1b51f434fd54f04bdea2cfa53794a3ecf21101fe925661f48c7db26ce069d728db4b0fd1ca720bcf81bef030622cfe8f1a2
|
7
|
+
data.tar.gz: 3103c29c3507af84fdfa488e345b291939dfcdeb484996d1b917795e56a04526f643eb85079b24bb3df3abf6133f8d40179373a128aac3ef17f2d4425a5f140f
|
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# G5 Integrations Updatable
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/g5_integrations_updatable)
|
4
|
-
[](https://circleci.com/gh/g5search/g5_integrations_updatable)
|
5
5
|
|
6
|
-
G5 Integrations Updatable provides a solution for automatic updates of
|
7
|
-
data when modified or created in the G5 Hub.
|
6
|
+
G5 Integrations Updatable provides a solution for automatic updates of integration settings from https://github.com/g5search/g5-integrations-dashboard
|
8
7
|
|
9
8
|
## Requirements
|
10
9
|
|
@@ -36,19 +35,36 @@ G5 Integrations Updatable makes use of PostgrSQL's `json` field type, and so onl
|
|
36
35
|
```console
|
37
36
|
rake g5_integrations_updatable:install:migrations
|
38
37
|
```
|
39
|
-
3.
|
38
|
+
3. Add your app to g5-integrations-dashboard's.
|
39
|
+
|
40
|
+
```console
|
41
|
+
cd ../g5-integrations-dashboard
|
42
|
+
rails c
|
43
|
+
IntegrationUpdatable.create(url: 'http://<your-app-host>/g5_integrations_updatable/feeds')
|
44
|
+
```
|
45
|
+
Now, if you make any changes in g5-integrations-dashboard, they will be migrated over to <your-app>.
|
46
|
+
3. Prime your database with all of G5-Integrations Dashboard's data
|
40
47
|
|
41
48
|
```console
|
42
49
|
rake g5_integrations_updatable:load_all
|
43
50
|
```
|
44
51
|
Note, all of the G5_AUTH env variables need to be set for this to work.
|
45
52
|
|
53
|
+
Or,
|
54
|
+
```console
|
55
|
+
cd ../g5-integrations-dashboard
|
56
|
+
rake g5_integrations_sync:integration_upatables
|
57
|
+
```
|
58
|
+
|
59
|
+
|
46
60
|
## Usage
|
47
61
|
|
48
|
-
G5 Integrations Updatable exposes a POST route at `/g5_integrations_updatable/create` that accepts a
|
49
|
-
`
|
62
|
+
G5 Integrations Updatable exposes a POST route at `/g5_integrations_updatable/feeds#create` that accepts a
|
63
|
+
`feed_url` parameter (the URL for the client's detail page within the G5
|
50
64
|
Hub). When the route is hit, it will update/create all location_settings under the client_setting.
|
51
65
|
|
66
|
+
G5 Integrations Updatable also exposes GET '/g5_integrations_updatable/feeds', which returns a JSON representation of all the settings.
|
67
|
+
|
52
68
|
|
53
69
|
### Spec Helpers
|
54
70
|
|
@@ -64,7 +80,7 @@ require 'g5_integrations_updatable/rspec'
|
|
64
80
|
|
65
81
|
## Contributing
|
66
82
|
|
67
|
-
1. [Fork it](https://github.com/
|
83
|
+
1. [Fork it](https://github.com/g5search/g5_integrations_updatable/fork)
|
68
84
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
85
|
3. Write your code and **specs**
|
70
86
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
@@ -72,7 +88,7 @@ require 'g5_integrations_updatable/rspec'
|
|
72
88
|
6. Create a new Pull Request
|
73
89
|
|
74
90
|
If you find bugs, have feature requests or questions, please
|
75
|
-
[file an issue](https://github.com/
|
91
|
+
[file an issue](https://github.com/g5search/g5_integrations_updatable/issues).
|
76
92
|
|
77
93
|
## Specs
|
78
94
|
|
@@ -13,7 +13,7 @@ module G5IntegrationsUpdatable::FindOrCreateFromFeed
|
|
13
13
|
client_uid: hash.delete('client_uid'),
|
14
14
|
client_urn: hash.delete('client_urn'),
|
15
15
|
client_name: hash.delete('client_name'),
|
16
|
-
|
16
|
+
strategy_type: hash.delete('strategy_type'),
|
17
17
|
job_frequency_in_minutes: hash.delete('job_frequency_in_minutes'),
|
18
18
|
properties: hash
|
19
19
|
)
|
@@ -6,12 +6,14 @@ module G5IntegrationsUpdatable
|
|
6
6
|
validates :uid, :urn, presence: true
|
7
7
|
validates :urn, :urn, presence: true
|
8
8
|
|
9
|
-
INVENTORY
|
10
|
-
|
9
|
+
INVENTORY = 'inventory'
|
10
|
+
LEAD_RESERVE = 'lead_reserve'
|
11
|
+
LEAD_QUOTE = 'lead_quote'
|
11
12
|
|
12
|
-
scope :
|
13
|
-
scope :by_inventory, -> {
|
14
|
-
scope :
|
13
|
+
scope :by_strategy_type, -> (vendor_strategy) { where(strategy_type: vendor_strategy) }
|
14
|
+
scope :by_inventory, -> { by_strategy_type(INVENTORY) }
|
15
|
+
scope :by_lead_reserve, -> { by_strategy_type(LEAD_RESERVE) }
|
16
|
+
scope :by_lead_quote, -> { by_strategy_type(LEAD_QUOTE) }
|
15
17
|
|
16
18
|
def to_param
|
17
19
|
urn
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class G5IntegrationsUpdatable::LocationSettingSerializer < ActiveModel::Serializer
|
2
2
|
attributes :uid, :urn, :location_uid, :location_urn, :location_name,
|
3
|
-
:client_uid, :client_urn, :client_name, :
|
3
|
+
:client_uid, :client_urn, :client_name, :strategy_type,
|
4
4
|
:job_frequency_in_minutes, :created_at, :updated_at
|
5
5
|
#leaving off 'properties' for now
|
6
6
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddVendorStrategyToLocationSettings < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :g5_integrations_updatable_location_settings, :strategy_type, :string
|
4
|
+
add_index :g5_integrations_updatable_location_settings, :strategy_type, name: 'index_strategy_type_on_location_settings'
|
5
|
+
|
6
|
+
G5IntegrationsUpdatable::LocationSetting.reset_column_information
|
7
|
+
G5IntegrationsUpdatable::LocationSetting.all.each do |location_setting|
|
8
|
+
location_setting.update_attributes(strategy_type: location_setting.vendor_action == 'inventory' ? 'inventory' : 'lead_reserve')
|
9
|
+
end
|
10
|
+
|
11
|
+
remove_column :g5_integrations_updatable_location_settings, :vendor_action
|
12
|
+
end
|
13
|
+
end
|
@@ -9,11 +9,15 @@ FactoryGirl.define do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
factory :inventory_location_setting, parent: :location_setting do
|
12
|
-
|
12
|
+
strategy_type { G5IntegrationsUpdatable::LocationSetting::INVENTORY }
|
13
13
|
job_frequency_in_minutes 5
|
14
14
|
end
|
15
15
|
|
16
|
-
factory :
|
17
|
-
|
16
|
+
factory :lead_reserve_location_setting, parent: :location_setting do
|
17
|
+
strategy_type { G5IntegrationsUpdatable::LocationSetting::LEAD_RESERVE }
|
18
|
+
end
|
19
|
+
|
20
|
+
factory :lead_quote_location_setting, parent: :location_setting do
|
21
|
+
strategy_type { G5IntegrationsUpdatable::LocationSetting::LEAD_QUOTE }
|
18
22
|
end
|
19
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_integrations_updatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perry Hertler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- app/views/layouts/g5_integrations_updatable/application.html.erb
|
173
173
|
- config/routes.rb
|
174
174
|
- db/migrate/20141119204321_create_location_settings.rb
|
175
|
+
- db/migrate/20141201204321_add_vendor_strategy_to_location_settings.rb
|
175
176
|
- lib/g5_integrations_updatable.rb
|
176
177
|
- lib/g5_integrations_updatable/engine.rb
|
177
178
|
- lib/g5_integrations_updatable/error.rb
|