barnyard_ccfeeder 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/barnyard_ccfeeder/version.rb +1 -1
- data/lib/barnyard_ccfeeder.rb +3 -1
- data/spec/push_change_spec.rb +29 -0
- data/spec/push_harvest_spec.rb +30 -0
- data/spec/push_transaction_spec.rb +19 -0
- data/spec/spec_helper.rb +4 -0
- metadata +21 -15
data/lib/barnyard_ccfeeder.rb
CHANGED
@@ -3,6 +3,7 @@ require "yaml"
|
|
3
3
|
require "logger"
|
4
4
|
require "rest-client"
|
5
5
|
require "crack"
|
6
|
+
require "json"
|
6
7
|
|
7
8
|
module BarnyardCcfeeder
|
8
9
|
YAML::ENGINE.yamler = 'syck'
|
@@ -234,10 +235,11 @@ module BarnyardCcfeeder
|
|
234
235
|
end
|
235
236
|
|
236
237
|
# a "transaction" is sent to a subscriber by the farmer based on the "change"
|
237
|
-
def push_transaction(subscription_id, queued_at, change_uuid, transaction_uuid
|
238
|
+
def push_transaction(subscription_id, queued_at, change_uuid, transaction_uuid)
|
238
239
|
|
239
240
|
data = Hash.new
|
240
241
|
|
242
|
+
data['subscription_id'] = subscription_id
|
241
243
|
data['queue_time'] = queued_at
|
242
244
|
data['change_uuid'] = change_uuid
|
243
245
|
data['uuid'] = transaction_uuid
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "barnyard_ccfeeder"
|
2
|
+
require "aws-sdk"
|
3
|
+
require "uuid"
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
describe "this" do
|
7
|
+
|
8
|
+
it "should load properly" do
|
9
|
+
|
10
|
+
cc = BarnyardCcfeeder::CacheCow.new :url => "http://localhost:3000"
|
11
|
+
|
12
|
+
queued_at = Time.now
|
13
|
+
crop_number = 1
|
14
|
+
primary_key = "ABC"
|
15
|
+
transaction_type = "add"
|
16
|
+
value = "{}"
|
17
|
+
old_value = "{}"
|
18
|
+
|
19
|
+
cc.push_change(queued_at,
|
20
|
+
$harvester_uuid,
|
21
|
+
$change_uuid,
|
22
|
+
crop_number,
|
23
|
+
primary_key,
|
24
|
+
transaction_type,
|
25
|
+
value,
|
26
|
+
old_value)
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "barnyard_ccfeeder"
|
2
|
+
require "aws-sdk"
|
3
|
+
require "uuid"
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
describe "this" do
|
7
|
+
|
8
|
+
it "should load properly" do
|
9
|
+
|
10
|
+
cc = BarnyardCcfeeder::CacheCow.new :url => "http://localhost:3000"
|
11
|
+
|
12
|
+
crop_number = 1
|
13
|
+
began_at = Time.now
|
14
|
+
ended_at = Time.now
|
15
|
+
number_of_changes = 0
|
16
|
+
number_of_adds = 1
|
17
|
+
number_of_deletes = 0
|
18
|
+
total_records = 1
|
19
|
+
|
20
|
+
cc.push_harvester_stats($harvester_uuid,
|
21
|
+
crop_number,
|
22
|
+
began_at,
|
23
|
+
ended_at,
|
24
|
+
total_records,
|
25
|
+
number_of_changes,
|
26
|
+
number_of_adds,
|
27
|
+
number_of_deletes)
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "barnyard_ccfeeder"
|
2
|
+
require "aws-sdk"
|
3
|
+
require "uuid"
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
describe "this" do
|
7
|
+
|
8
|
+
it "should load properly" do
|
9
|
+
|
10
|
+
cc = BarnyardCcfeeder::CacheCow.new :url => "http://localhost:3000"
|
11
|
+
|
12
|
+
queued_at = Time.now
|
13
|
+
|
14
|
+
subscription_id = 1
|
15
|
+
|
16
|
+
cc.push_transaction(subscription_id, queued_at, $change_uuid, $transaction_uuid)
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barnyard_ccfeeder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70129639616900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70129639616900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: aws-sdk
|
27
|
-
requirement: &
|
27
|
+
requirement: &70129639612360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70129639612360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: logger
|
38
|
-
requirement: &
|
38
|
+
requirement: &70129639607680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70129639607680
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &70129639603060 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70129639603060
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: crack
|
60
|
-
requirement: &
|
60
|
+
requirement: &70129639596100 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70129639596100
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
-
requirement: &
|
71
|
+
requirement: &70129639584440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70129639584440
|
80
80
|
description: Feeds the Cache Cow
|
81
81
|
email:
|
82
82
|
- supercoder@gmail.com
|
@@ -93,6 +93,9 @@ files:
|
|
93
93
|
- barnyard_ccfeeder.gemspec
|
94
94
|
- lib/barnyard_ccfeeder.rb
|
95
95
|
- lib/barnyard_ccfeeder/version.rb
|
96
|
+
- spec/push_change_spec.rb
|
97
|
+
- spec/push_harvest_spec.rb
|
98
|
+
- spec/push_transaction_spec.rb
|
96
99
|
- spec/query_spec.rb
|
97
100
|
- spec/spec_helper.rb
|
98
101
|
homepage: https://github.com/jongillies/barnyard/tree/master/barnyard_ccfeeder
|
@@ -115,10 +118,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
118
|
version: '0'
|
116
119
|
requirements: []
|
117
120
|
rubyforge_project: barnyard_ccfeeder
|
118
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.15
|
119
122
|
signing_key:
|
120
123
|
specification_version: 3
|
121
124
|
summary: REST API to the Cache Cow
|
122
125
|
test_files:
|
126
|
+
- spec/push_change_spec.rb
|
127
|
+
- spec/push_harvest_spec.rb
|
128
|
+
- spec/push_transaction_spec.rb
|
123
129
|
- spec/query_spec.rb
|
124
130
|
- spec/spec_helper.rb
|