gnip-rule 0.4.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 650ba60f236a395d91853a056c1dcb3777ceb8c3
4
- data.tar.gz: 07ebd7fe6bf7a6a286e41ff08f3f48469d5b1186
3
+ metadata.gz: 837b40ae0dbc3b6be754e6900087803bfe31ccec
4
+ data.tar.gz: 1f87c582cea9d69ba109b3be0c5b857f3f58c80f
5
5
  SHA512:
6
- metadata.gz: 4540fb96b0e535aec002b4f70eefb054814a7a0813edd4039bb18e66006730860729ab5cd0ee828a460b9c109767c71b2c32e57289a7626adb4be0f0595bd376
7
- data.tar.gz: 36e5a1c56344be18127e180a8c5b9dbcc06b4729b92f15c2373602cce6057ae691747ad703b49648da86a0337f5f9957a932cd01ba5baabaaa13f8521b2e47de
6
+ metadata.gz: b72a3008577014b04aeaadbc77d1b46b564bf7300f42768a6e19c13e95b54657f9a217bc803e30c10aff739cb8c2c913227adfd296e25486b4c58217534ac5cf
7
+ data.tar.gz: 6bf4b8beaed0b2ded400ea749cb11877d22ef1584c2087b905be663d1be85706efd8c9cac8745c2ded5c88f345dbbbe56b93eeee82b08f9190a1a6ea51cca385
@@ -29,10 +29,16 @@ module GnipRule
29
29
 
30
30
  def gen_json_payload(input, tag=nil)
31
31
  input = [input] unless input.respond_to? :collect
32
- {:rules => input.collect { |i|
33
- raise 'Input must be convertable to GnipRule::Rule' unless i.respond_to? :to_rule
34
- i.to_rule(tag).to_hash
35
- }}.to_json
32
+ rules = input.map { |i|
33
+ if i.respond_to?(:to_rule)
34
+ i.to_rule(tag)
35
+ elsif i.is_a?(String)
36
+ GnipRule::Rule.new(i, tag)
37
+ else
38
+ raise 'Input must be convertable to GnipRule::Rule'
39
+ end
40
+ }
41
+ { rules: rules.map(&:to_hash) }.to_json
36
42
  end
37
43
 
38
44
  protected
@@ -1,11 +1,5 @@
1
1
  require 'json'
2
2
 
3
- class String
4
- def to_rule(tag=nil)
5
- GnipRule::Rule.new(self, tag)
6
- end
7
- end
8
-
9
3
  module GnipRule
10
4
  class Rule
11
5
  attr_accessor :value, :tag
@@ -21,7 +15,7 @@ module GnipRule
21
15
  return false if contains_stop_word?
22
16
  return false if contains_empty_source?
23
17
  return false if contains_negated_or?
24
- return true
18
+ true
25
19
  end
26
20
 
27
21
  # NOTE: Unused variable for consistency with other to_rule impls
@@ -45,12 +39,12 @@ module GnipRule
45
39
 
46
40
  protected
47
41
  def contains_stop_word?
48
- stop_words = %W(a an and at but by com from http https if in is it its me my or rt the this to too via we www you)
42
+ stop_words = %W(a an and AND at but by com from http https if in is it its me my NOT or rt the this to too via we www you)
49
43
  (stop_words & @value.gsub(/\"[^\"]*\"/, '').split(/\s/)).size > 0
50
44
  end
51
45
 
52
46
  def too_long?
53
- @value.size > 1024
47
+ @value.size > 2048
54
48
  end
55
49
 
56
50
  def contains_negated_or?
@@ -1,3 +1,3 @@
1
1
  module GnipRule
2
- VERSION = '0.4.3'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnip-rule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Wendelin
8
+ - Leon Miller-Out
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
12
+ date: 2016-11-16 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
@@ -16,84 +17,56 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '10.0'
20
+ version: '11.3'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '10.0'
27
+ version: '11.3'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rspec
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
- version: '2.13'
34
+ version: '3.5'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: '2.13'
41
+ version: '3.5'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: webmock
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - "~>"
46
47
  - !ruby/object:Gem::Version
47
- version: '1.8'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.8'
55
- - !ruby/object:Gem::Dependency
56
- name: guard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.6'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.6'
69
- - !ruby/object:Gem::Dependency
70
- name: guard-rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.5'
48
+ version: '2.0'
76
49
  type: :development
77
50
  prerelease: false
78
51
  version_requirements: !ruby/object:Gem::Requirement
79
52
  requirements:
80
53
  - - "~>"
81
54
  - !ruby/object:Gem::Version
82
- version: '2.5'
55
+ version: '2.0'
83
56
  - !ruby/object:Gem::Dependency
84
57
  name: fuubar
85
58
  requirement: !ruby/object:Gem::Requirement
86
59
  requirements:
87
60
  - - "~>"
88
61
  - !ruby/object:Gem::Version
89
- version: '1.1'
62
+ version: '2.2'
90
63
  type: :development
91
64
  prerelease: false
92
65
  version_requirements: !ruby/object:Gem::Requirement
93
66
  requirements:
94
67
  - - "~>"
95
68
  - !ruby/object:Gem::Version
96
- version: '1.1'
69
+ version: '2.2'
97
70
  - !ruby/object:Gem::Dependency
98
71
  name: coveralls
99
72
  requirement: !ruby/object:Gem::Requirement
@@ -109,64 +82,49 @@ dependencies:
109
82
  - !ruby/object:Gem::Version
110
83
  version: '0.6'
111
84
  - !ruby/object:Gem::Dependency
112
- name: rb-fsevent
85
+ name: rest-client
113
86
  requirement: !ruby/object:Gem::Requirement
114
87
  requirements:
115
88
  - - ">="
116
89
  - !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: ruby_gntp
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
90
+ version: '1.6'
91
+ - - "<"
130
92
  - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
93
+ version: '3'
94
+ type: :runtime
133
95
  prerelease: false
134
96
  version_requirements: !ruby/object:Gem::Requirement
135
97
  requirements:
136
98
  - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rest-client
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
99
  - !ruby/object:Gem::Version
145
100
  version: '1.6'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
101
+ - - "<"
151
102
  - !ruby/object:Gem::Version
152
- version: '1.6'
103
+ version: '3'
153
104
  - !ruby/object:Gem::Dependency
154
105
  name: json
155
106
  requirement: !ruby/object:Gem::Requirement
156
107
  requirements:
157
- - - "~>"
108
+ - - ">="
158
109
  - !ruby/object:Gem::Version
159
110
  version: '1.8'
111
+ - - "<"
112
+ - !ruby/object:Gem::Version
113
+ version: '3'
160
114
  type: :runtime
161
115
  prerelease: false
162
116
  version_requirements: !ruby/object:Gem::Requirement
163
117
  requirements:
164
- - - "~>"
118
+ - - ">="
165
119
  - !ruby/object:Gem::Version
166
120
  version: '1.8'
121
+ - - "<"
122
+ - !ruby/object:Gem::Version
123
+ version: '3'
167
124
  description: Ruby library for working with the Gnip Rules API
168
125
  email:
169
126
  - me@eriwen.com
127
+ - leon@singlebrook.com
170
128
  executables: []
171
129
  extensions: []
172
130
  extra_rdoc_files: []
@@ -175,7 +133,7 @@ files:
175
133
  - lib/gnip-rule/client.rb
176
134
  - lib/gnip-rule/rule.rb
177
135
  - lib/gnip-rule/version.rb
178
- homepage: https://github.com/eriwen/gnip-rule
136
+ homepage: https://github.com/singlebrook/gnip-rule
179
137
  licenses: []
180
138
  metadata: {}
181
139
  post_install_message:
@@ -186,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
144
  requirements:
187
145
  - - ">="
188
146
  - !ruby/object:Gem::Version
189
- version: '0'
147
+ version: '2.0'
190
148
  required_rubygems_version: !ruby/object:Gem::Requirement
191
149
  requirements:
192
150
  - - ">="
@@ -194,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
152
  version: '0'
195
153
  requirements: []
196
154
  rubyforge_project: gnip-rule
197
- rubygems_version: 2.4.5
155
+ rubygems_version: 2.6.4
198
156
  signing_key:
199
157
  specification_version: 4
200
158
  summary: Ruby library for working with the Gnip Rules API