rulesio 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +3 -3
- data/lib/rulesio/girl_friday_queue.rb +1 -0
- data/lib/rulesio/railtie.rb +1 -1
- data/lib/rulesio/users.rb +0 -4
- data/lib/rulesio/version.rb +1 -1
- data/lib/rulesio.rb +4 -2
- metadata +66 -70
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 Traction.IO UG
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
rulesio gem for rules.io
|
2
2
|
=========
|
3
3
|
|
4
|
-
[rules.io](
|
4
|
+
[rules.io](https://rules.io) is a rules engine that reacts to things users do or experience in your software, and makes things happen in 3rd party SaaS APIs -- without your having to write any code. Rather than implementing the most rapidly evolving parts of your application's business logic in code, your team can use the rules.io web app to specify "when", "how", and "who", with rules like these:
|
5
5
|
|
6
6
|
* when a user gets a form validation error three times in an hour, send an email to Frank
|
7
7
|
* when a premium customer hasn't logged in for a month, flag them in your CRM
|
@@ -45,7 +45,7 @@ The string will be evaluated in the context of your controller.
|
|
45
45
|
Sending other events
|
46
46
|
--------------------
|
47
47
|
|
48
|
-
Every event must contain the \_actor, \_timestamp, \_domain and \_name fields. Beyond those fields, you can include any additional data you choose. See [docs](
|
48
|
+
Every event must contain the \_actor, \_timestamp, \_domain and \_name fields. Beyond those fields, you can include any additional data you choose. See [docs](https://rules.io/docs) for more details.
|
49
49
|
|
50
50
|
To manually send an event when a user upgrades to a "premium" account:
|
51
51
|
|
@@ -87,7 +87,7 @@ Options
|
|
87
87
|
RulesIO::Rack accepts these options:
|
88
88
|
|
89
89
|
* `token` -- the token for a rules.io channel
|
90
|
-
* `webhook_url` -- defaults to '
|
90
|
+
* `webhook_url` -- defaults to 'https://www.rules.io/events'
|
91
91
|
* `middleware` -- takes the symbol for a middleware and a block, configuring it
|
92
92
|
* `queue` -- takes the class used for queuing (default: RulesIO::MemoryQueue), and an optional hash; see the section on girl_friday for examples
|
93
93
|
* `controller_data` -- a string evaluated in the context of the Rails controller (if any) handling the request; it should return a hash to be merged into every event (both automatically generated and manually triggered events)
|
data/lib/rulesio/railtie.rb
CHANGED
@@ -5,7 +5,7 @@ module RulesIO
|
|
5
5
|
class RailsConfigurator
|
6
6
|
attr_accessor :token, :webhook_url, :middlewares, :queue, :controller_data, :queue_options
|
7
7
|
def initialize
|
8
|
-
@webhook_url = '
|
8
|
+
@webhook_url = 'https://www.rules.io/events/'
|
9
9
|
@middlewares = {}
|
10
10
|
end
|
11
11
|
|
data/lib/rulesio/users.rb
CHANGED
data/lib/rulesio/version.rb
CHANGED
data/lib/rulesio.rb
CHANGED
@@ -33,7 +33,9 @@ module RulesIO
|
|
33
33
|
req = Net::HTTP::Post.new(uri.path)
|
34
34
|
req.body = payload.to_json
|
35
35
|
req.content_type = 'application/json'
|
36
|
-
Net::HTTP.
|
36
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
37
|
+
http.use_ssl = true if RulesIO.webhook_url =~ /^https:/
|
38
|
+
http.start do |http|
|
37
39
|
http.request(req)
|
38
40
|
end
|
39
41
|
end
|
@@ -115,7 +117,7 @@ module RulesIO
|
|
115
117
|
def initialize(app, options={})
|
116
118
|
@app = app
|
117
119
|
RulesIO.logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
118
|
-
RulesIO.webhook_url = options[:webhook_url] || '
|
120
|
+
RulesIO.webhook_url = options[:webhook_url] || 'https://www.rules.io/events/'
|
119
121
|
RulesIO.buffer = []
|
120
122
|
RulesIO.filter_parameters = defined?(Rails) ? Rails.application.config.filter_parameters : []
|
121
123
|
RulesIO.token = options[:token]
|
metadata
CHANGED
@@ -1,73 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rulesio
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 2
|
9
|
-
version: 0.9.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.3
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- David Anderson
|
13
9
|
- Chris Weis
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-08-31 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: activesupport
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
31
23
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: actionpack
|
35
24
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: actionpack
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
43
39
|
type: :runtime
|
44
|
-
version_requirements: *id002
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: girl_friday
|
47
40
|
prerelease: false
|
48
|
-
|
49
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: girl_friday
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
50
52
|
- - ~>
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
segments:
|
53
|
-
- 0
|
54
|
-
- 10
|
55
|
-
- 0
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 0.10.0
|
57
55
|
type: :runtime
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.10.0
|
63
|
+
description: Rack middleware for connecting Rack applications to rules.io, with extensions
|
64
|
+
for Rails 3 applications.
|
65
|
+
email:
|
61
66
|
- david@alpinegizmo.com
|
62
67
|
executables: []
|
63
|
-
|
64
68
|
extensions: []
|
65
|
-
|
66
69
|
extra_rdoc_files: []
|
67
|
-
|
68
|
-
files:
|
70
|
+
files:
|
69
71
|
- .gitignore
|
70
72
|
- Gemfile
|
73
|
+
- MIT-LICENSE
|
71
74
|
- README.md
|
72
75
|
- Rakefile
|
73
76
|
- lib/rulesio.rb
|
@@ -80,35 +83,28 @@ files:
|
|
80
83
|
- lib/rulesio/users.rb
|
81
84
|
- lib/rulesio/version.rb
|
82
85
|
- rulesio.gemspec
|
83
|
-
has_rdoc: true
|
84
86
|
homepage: https://github.com/rulesio/rulesio
|
85
87
|
licenses: []
|
86
|
-
|
87
88
|
post_install_message:
|
88
89
|
rdoc_options: []
|
89
|
-
|
90
|
-
require_paths:
|
90
|
+
require_paths:
|
91
91
|
- lib
|
92
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
- 0
|
105
|
-
version: "0"
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
106
104
|
requirements: []
|
107
|
-
|
108
105
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.8.24
|
110
107
|
signing_key:
|
111
108
|
specification_version: 3
|
112
109
|
summary: Rack middleware for connecting to rules.io
|
113
110
|
test_files: []
|
114
|
-
|