seven1m-onebody-updateagent 0.2.1 → 0.2.2

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.
@@ -0,0 +1,30 @@
1
+ class ExternalGroupUpdater < UpdateAgent
2
+ self.resource = ExternalGroup
3
+
4
+ def check_for_invalid_columns; end
5
+
6
+ def compare
7
+ groups = resource.find(:all)
8
+ @data.each do |record|
9
+ if !(group = groups.detect { |g| g.external_id == record['id'] })
10
+ @create << record
11
+ elsif group.name != record['name'] or group.category.to_s != record['category'].to_s
12
+ @update << record
13
+ end
14
+ end
15
+ end
16
+
17
+ def push
18
+ puts 'Updating remote end...'
19
+ @create.each do |record|
20
+ group = resource.new(:external_id => record['id'], :name => record['name'], :category => record['category'])
21
+ group.save
22
+ end
23
+ @update.each do |record|
24
+ group = resource.find(record['id'], :params => {:external_id => true})
25
+ group.name = record['name']
26
+ group.category = record['category']
27
+ group.save
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seven1m-onebody-updateagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Morgan
@@ -63,8 +63,10 @@ files:
63
63
  - lib/updateagent/converters/acs_converter.rb
64
64
  - lib/updateagent/updaters/family_updater.rb
65
65
  - lib/updateagent/updaters/people_updater.rb
66
+ - lib/updateagent/updaters/external_group_updater.rb
66
67
  has_rdoc: false
67
68
  homepage: http://github.com/seven1m/onebody-updateagent
69
+ licenses:
68
70
  post_install_message:
69
71
  rdoc_options: []
70
72
 
@@ -85,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
87
  requirements: []
86
88
 
87
89
  rubyforge_project:
88
- rubygems_version: 1.2.0
90
+ rubygems_version: 1.3.5
89
91
  signing_key:
90
92
  specification_version: 2
91
93
  summary: Companion to OneBody that handles sync with external data source.