tigre-client 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tigre-client (0.3.6)
4
+ tigre-client (0.3.7)
5
5
  faraday (~> 0.6.0)
6
6
 
7
7
  GEM
@@ -1,6 +1,17 @@
1
1
  module Tigre
2
2
  class Analysis
3
3
 
4
+ extend Tigre::CommonParams
5
+ extend Tigre::CommonGetters
6
+
7
+ def get(analysis_id)
8
+ if analysis_id == ''
9
+ raise "Missing analysis_id parameter"
10
+ end
11
+
12
+ Tigre.get_connection("analyses/#{analysis_id}")
13
+ end
14
+
4
15
  # required
5
16
  # analysis_id => String
6
17
  # params_hash => Hash
@@ -13,13 +24,13 @@ module Tigre
13
24
  raise "Missing analysis_id parameter or params_hash is empty"
14
25
  end
15
26
 
16
- update_data = {}
17
27
  if params_hash[:mutex_name_list]
18
28
  params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list])
19
29
  end
20
- update_data["metadatas"] = params_hash
21
30
 
22
- Tigre.put_connection("/analysis/#{analysis_id}", update_data)
31
+ update_data = {:metadatas => params_hash}
32
+
33
+ Tigre.put_connection("/analyses/#{analysis_id}", update_data)
23
34
  end
24
35
 
25
36
  # required
@@ -32,8 +43,7 @@ module Tigre
32
43
  end
33
44
 
34
45
  update_data = {:file => File.new(file_location), :file_type => file_type}
35
-
36
- Tigre.put_connection("/analysis/#{analysis_id}/upload", update_data)
46
+ Tigre.put_connection("/analyses/#{analysis_id}/upload", update_data)
37
47
  end
38
48
 
39
49
  end
@@ -0,0 +1,44 @@
1
+ module Tigre
2
+ module AnalysisComponents
3
+
4
+ # required
5
+ # digest_hash => Hash
6
+ # :digest => String, The digest type
7
+ # :value => String, The digest value
8
+ # optional params
9
+ # params_hash => Hash
10
+ # :dbts => Hash {:key1 => value, :key2 => value} where the key is what the name of the
11
+ # attribute is and the value should be a boolean
12
+ # :mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
13
+ # :mutex_name_list => Array => ['foo', 'bar', 'baz']
14
+ def add_analysis(digest_hash, params_hash={})
15
+ unless digest_hash[:digest] && digest_hash[:value]
16
+ raise 'Missing parameter :digest or :value'
17
+ end
18
+
19
+ if params_hash
20
+ update_data = {}
21
+ if params_hash[:mutex_name_list]
22
+ params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list])
23
+ end
24
+
25
+ update_data["metadatas"] = params_hash
26
+ end
27
+
28
+ Tigre.put_connection("/#{get_klass}/#{digest_hash[:digest]}/value/#{digest_hash[:value]}/analysis", update_data)
29
+ end
30
+
31
+ # required params
32
+ # hash => Hash
33
+ # :digest => String, The digest type
34
+ # :value => String, The digest value
35
+ def self.get_analyses(hash)
36
+ unless hash[:digest] && hash[:value]
37
+ raise 'Missing parameter :digest or :value'
38
+ end
39
+
40
+ Tigre.get_connection("/#{get_klass}/#{hash[:digest]}/value/#{hash[:value]}/analyses")
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,25 @@
1
+ module Tigre
2
+ module CommonGetters
3
+
4
+ # optional params
5
+ # options => Hash
6
+ # :page => Integer, :default => 0
7
+ # :per => Integer, :default => 50
8
+ # :after => Ruby DateTime object OR Integer (epoch time)
9
+ # :before => Ruby DateTime object OR Integer (epoch time)
10
+ def index(options={})
11
+ common_params(options)
12
+ Tigre.get_connection("/#{get_klass}?#{before_after_page_per}")
13
+ end
14
+
15
+ # optional params
16
+ # options => Hash
17
+ # :after => Ruby DateTime object OR Integer (epoch time)
18
+ # :before => Ruby DateTime object OR Integer (epoch time)
19
+ def count(options={})
20
+ common_params(options)
21
+ Tigre.get_connection("/#{get_klass}/count?#{before_after}")
22
+ end
23
+
24
+ end
25
+ end
@@ -1,6 +1,17 @@
1
1
  module Tigre
2
2
  module CommonParams
3
-
3
+
4
+ def get_klass
5
+ case self.to_s
6
+ when 'Tigre::Url'
7
+ 'urls'
8
+ when 'Tigre::Sample'
9
+ 'samples'
10
+ when 'Tigre::Analysis'
11
+ 'analyses'
12
+ end
13
+ end
14
+
4
15
  def common_params(params)
5
16
  @page = params[:page] ||= 0
6
17
  @per = params[:per] ||= 50
@@ -34,5 +45,17 @@ module Tigre
34
45
  logic.to_s
35
46
  end
36
47
 
48
+ def before_after_page_per
49
+ "#{before_after}&#{page_per}"
50
+ end
51
+
52
+ def page_per
53
+ "page=#{@page}&per=#{@per}"
54
+ end
55
+
56
+ def before_after
57
+ "after=#{@after}&before=#{@before}"
58
+ end
59
+
37
60
  end
38
61
  end
@@ -0,0 +1,89 @@
1
+ module Tigre
2
+ module TagComponents
3
+
4
+ # required params
5
+ # tags => String => I.E 'foo'
6
+ # tags => String (comma seperated) => I.E 'foo,bar,baz'
7
+ # tags => Array => ['foo', 'bar', 'baz']
8
+ # optional params
9
+ # options => Hash
10
+ # :after => Ruby DateTime object OR Integer (epoch time)
11
+ # :before => Ruby DateTime object OR Integer (epoch time)
12
+ # :page => Integer, :default => 0
13
+ # :per => Integer, :default => 50
14
+ def tagged_with(tags, options={})
15
+ if tags == ''
16
+ raise "Missing tags parameter"
17
+ end
18
+
19
+ common_params(options)
20
+ tags = package_array_list(tags)
21
+ Tigre.get_connection("/#{get_klass}/tagged_with?tags=#{tags}&#{before_after_page_per}")
22
+ end
23
+
24
+ # required params
25
+ # hash => Hash
26
+ # :digest => String, The digest type
27
+ # :value => String, The digest value
28
+ # :tag_list => String (comma seperated) => I.E 'foo,bar,baz'
29
+ # :tag_list => Array => ['foo', 'bar', 'baz']
30
+ def remove_tags(hash)
31
+ unless hash[:digest] && hash[:value] && hash[:tag_list]
32
+ raise 'Missing parameter :digest or :value or :tag_list'
33
+ end
34
+
35
+ update_data = {"tag_list" => package_array_list(hash[:tag_list])}
36
+ Tigre.put_connection("/#{get_klass}/#{hash[:digest]}/value/#{hash[:value]}/remove_tags", update_data)
37
+ end
38
+
39
+ # required params
40
+ # tags => String => I.E 'foo'
41
+ # tags => String (comma seperated) => I.E 'foo,bar,baz'
42
+ # tags => Array => ['foo', 'bar', 'baz']
43
+ # optional params
44
+ # options => Hash
45
+ # :after => Ruby DateTime object OR Integer (epoch time)
46
+ # :before => Ruby DateTime object OR Integer (epoch time)
47
+ # :page => Integer, :default => 0
48
+ # :per => Integer, :default => 50
49
+ def not_tagged_with(tags, options={})
50
+ if tags == ''
51
+ raise "Missing tags parameter"
52
+ end
53
+
54
+ tags = package_array_list(tags)
55
+ common_params(options)
56
+ Tigre.get_connection("/#{get_klass}/not_tagged_with?tags=#{tags}&#{before_after_page_per}")
57
+ end
58
+
59
+ # optional params
60
+ # options => Hash
61
+ # :after => Ruby DateTime object OR Integer (epoch time)
62
+ # :before => Ruby DateTime object OR Integer (epoch time)
63
+ # :page => Integer, :default => 0
64
+ # :per => Integer, :default => 50
65
+ def not_tagged(options={})
66
+ common_params(options)
67
+ Tigre.get_connection("/#{get_klass}/not_tagged?#{before_after_page_per}")
68
+ end
69
+
70
+ # required params
71
+ # tags => String => I.E 'foo'
72
+ # tags => String (comma seperated) => I.E 'foo,bar,baz'
73
+ # tags => Array => ['foo', 'bar', 'baz']
74
+ # optional params
75
+ # options => Hash
76
+ # :after => Ruby DateTime object OR Integer (epoch time)
77
+ # :before => Ruby DateTime object OR Integer (epoch time)
78
+ def tagged_count(tags, options={})
79
+ if tags == ''
80
+ raise "Missing tags parameter"
81
+ end
82
+
83
+ tags = package_array_list(tags)
84
+ common_params(options)
85
+ Tigre.get_connection("/#{get_klass}/tagged_with?tags=#{tags}&#{before_after}")
86
+ end
87
+
88
+ end
89
+ end
@@ -2,7 +2,9 @@ module Tigre
2
2
  class Sample
3
3
 
4
4
  extend Tigre::CommonParams
5
-
5
+ extend Tigre::CommonGetters
6
+ extend Tigre::TagComponents
7
+
6
8
  # required params
7
9
  # file_location => String path to the file
8
10
  # md5 => String
@@ -21,16 +23,7 @@ module Tigre
21
23
  post_data = {:file => File.new(file_location), :md5 => md5}
22
24
  Tigre.post_connection('/samples', post_data.merge(options))
23
25
  end
24
-
25
- # optional params
26
- # options => Hash
27
- # :page => Integer, :default => 0
28
- # :per => Integer, :default => 50
29
- def self.index(options={})
30
- common_params(options)
31
- Tigre.get_connection("/samples?page=#{@page}&per=#{@per}")
32
- end
33
-
26
+
34
27
  # required params
35
28
  # md5 => String
36
29
  # params_hash => Hash
@@ -82,58 +75,7 @@ module Tigre
82
75
  params_hash = {:digest => 'sha256', :value => sha256}
83
76
  self.get(params_hash)
84
77
  end
85
-
86
- # required params
87
- # tags => String => I.E 'foo'
88
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
89
- # tags => Array => ['foo', 'bar', 'baz']
90
- # optional params
91
- # options => Hash
92
- # :after => Ruby DateTime object OR Integer (epoch time)
93
- # :before => Ruby DateTime object OR Integer (epoch time)
94
- # :page => Integer, :default => 0
95
- # :per => Integer, :default => 50
96
- def self.tagged_with(tags, options={})
97
- if tags == ''
98
- raise "Missing tags parameter"
99
- end
100
78
 
101
- common_params(options)
102
- tags = package_array_list(tags)
103
- Tigre.get_connection("/samples/tagged_with?tags=#{tags}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
104
- end
105
-
106
- # required params
107
- # tags => String => I.E 'foo'
108
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
109
- # tags => Array => ['foo', 'bar', 'baz']
110
- # optional params
111
- # options => Hash
112
- # :after => Ruby DateTime object OR Integer (epoch time)
113
- # :before => Ruby DateTime object OR Integer (epoch time)
114
- # :page => Integer, :default => 0
115
- # :per => Integer, :default => 50
116
- def self.not_tagged_with(tags, options={})
117
- if tags == ''
118
- raise "Missing tags parameter"
119
- end
120
-
121
- tags = package_array_list(tags)
122
- common_params(options)
123
- Tigre.get_connection("/samples/not_tagged_with?tags=#{tags}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
124
- end
125
-
126
- # optional params
127
- # options => Hash
128
- # :after => Ruby DateTime object OR Integer (epoch time)
129
- # :before => Ruby DateTime object OR Integer (epoch time)
130
- # :page => Integer, :default => 0
131
- # :per => Integer, :default => 50
132
- def self.not_tagged(options={})
133
- common_params(options)
134
- Tigre.get_connection("/samples/not_tagged?after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
135
- end
136
-
137
79
  # required
138
80
  # md5 => String
139
81
  # tags => String => I.E 'foo'
@@ -148,21 +90,6 @@ module Tigre
148
90
  Tigre.put_connection("/samples/#{md5}/add_tags", update_data)
149
91
  end
150
92
 
151
- # required params
152
- # hash => Hash
153
- # :digest => String, The digest type
154
- # :value => String, The digest value
155
- # :tag_list => String (comma seperated) => I.E 'foo,bar,baz'
156
- # :tag_list => Array => ['foo', 'bar', 'baz']
157
- def self.remove_tags(hash)
158
- unless hash[:digest] && hash[:value] && hash[:tag_list]
159
- raise 'Missing parameter :digest or :value or :tag_list'
160
- end
161
-
162
- update_data = {"tag_list" => package_array_list(hash[:tag_list])}
163
- Tigre.put_connection("/samples/#{hash[:digest]}/value/#{hash[:value]}/remove_tags", update_data)
164
- end
165
-
166
93
  # required params
167
94
  # tags => String => I.E 'foo'
168
95
  # tags => String (comma seperated) => I.E 'foo,bar,baz'
@@ -180,7 +107,7 @@ module Tigre
180
107
 
181
108
  common_params(options)
182
109
  mime_types = package_array_list(mime_types)
183
- Tigre.get_connection("/samples/has_mime_type?mime_types=#{mime_types}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
110
+ Tigre.get_connection("/samples/has_mime_type?mime_types=#{mime_types}&#{before_after_page_per}")
184
111
  end
185
112
 
186
113
  # required params
@@ -200,7 +127,7 @@ module Tigre
200
127
 
201
128
  common_params(options)
202
129
  mime_types = package_array_list(mime_types)
203
- Tigre.get_connection("/samples/without_mime_type?mime_types=#{mime_types}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
130
+ Tigre.get_connection("/samples/without_mime_type?mime_types=#{mime_types}&#{before_after_page_per}")
204
131
  end
205
132
 
206
133
  # optional params
@@ -211,7 +138,7 @@ module Tigre
211
138
  # :per => Integer, :default => 50
212
139
  def self.no_mime_type(options={})
213
140
  common_params(options)
214
- Tigre.get_connection("/samples/no_mime_type?after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
141
+ Tigre.get_connection("/samples/no_mime_type?#{before_after_page_per}")
215
142
  end
216
143
 
217
144
  # required params
@@ -263,59 +190,5 @@ module Tigre
263
190
  Tigre.post_connection('/samples_for_compression', hash)
264
191
  end
265
192
 
266
- # required
267
- # digest_hash => Hash
268
- # :digest => String, The digest type
269
- # :value => String, The digest value
270
- # optional params
271
- # params_hash => Hash
272
- # :dbts => Hash {:key1 => value, :key2 => value} where the key is what the name of the
273
- # attribute is and the value should be a boolean
274
- # :mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
275
- # :mutex_name_list => Array => ['foo', 'bar', 'baz']
276
- def self.add_analysis(digest_hash, params_hash={})
277
- unless digest_hash[:digest] && digest_hash[:value]
278
- raise 'Missing parameter :digest or :value'
279
- end
280
-
281
- if params_hash
282
- update_data = {}
283
- if params_hash[:mutex_name_list]
284
- params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list])
285
- end
286
-
287
- update_data["metadatas"] = params_hash
288
- end
289
-
290
- Tigre.put_connection("/samples/#{digest_hash[:digest]}/value/#{digest_hash[:value]}/analysis", update_data)
291
- end
292
-
293
- # optional params
294
- # options => Hash
295
- # :after => Ruby DateTime object OR Integer (epoch time)
296
- # :before => Ruby DateTime object OR Integer (epoch time)
297
- def self.count(options={})
298
- common_params(options)
299
- Tigre.get_connection("/samples/count?after=#{@after}&before=#{@before}")
300
- end
301
-
302
- # required params
303
- # tags => String => I.E 'foo'
304
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
305
- # tags => Array => ['foo', 'bar', 'baz']
306
- # optional params
307
- # options => Hash
308
- # :after => Ruby DateTime object OR Integer (epoch time)
309
- # :before => Ruby DateTime object OR Integer (epoch time)
310
- def self.tagged_count(tags, options={})
311
- if tags == ''
312
- raise "Missing tags parameter"
313
- end
314
-
315
- tags = package_array_list(tags)
316
- common_params(options)
317
- Tigre.get_connection("/samples/tagged_with?tags=#{tags}&after=#{@after}&before=#{@before}")
318
- end
319
-
320
193
  end
321
194
  end
@@ -2,7 +2,10 @@ module Tigre
2
2
  class Url
3
3
 
4
4
  extend Tigre::CommonParams
5
-
5
+ extend Tigre::CommonGetters
6
+ extend Tigre::TagComponents
7
+ extend Tigre::AnalysisComponents
8
+
6
9
  # required params
7
10
  # url => String
8
11
  # options => Hash
@@ -61,13 +64,13 @@ module Tigre
61
64
  end
62
65
 
63
66
  # required params
64
- # sha256 => String ** DEPRECATED ** => use Tigre::Url.get(:digest => 'sha256', :value => 'your-sha256')
67
+ # sha256 => String ** DEPRECATED ** => use get(:digest => 'sha256', :value => 'your-sha256')
65
68
  # hash => Hash
66
69
  # :digest => String, The digest type
67
70
  # :value => String, The digest value
68
71
  def self.get(hash)
69
72
  if hash.is_a?(String)
70
- Tigre.logger.warn "** DEPRECATED PARAMETER ** Use Tigre::Url.get(:digest => 'sha256', :value => 'your-sha256')" if Tigre.logger
73
+ Tigre.logger.warn "** DEPRECATED PARAMETER ** Use get(:digest => 'sha256', :value => 'your-sha256')" if Tigre.logger
71
74
  hash = {:digest => 'sha256', :value => hash}
72
75
  end
73
76
 
@@ -89,27 +92,24 @@ module Tigre
89
92
  self.get(:digest => 'md5', :value => md5)
90
93
  end
91
94
 
92
- # optional params
93
- # options => Hash
94
- # :page => Integer, :default => 0
95
- # :per => Integer, :default => 50
96
- def self.index(options={})
97
- self.common_params(options)
98
- Tigre.get_connection("/urls?page=#{@page}&per=#{@per}")
99
- end
100
-
95
+ ##
96
+ # DEPRECATED => use Tigre::Url.index(options)
97
+ #
101
98
  # required params
102
99
  # options => Hash
103
100
  # :after => Ruby DateTime object OR Integer (epoch time)
104
101
  # :before => Ruby DateTime object OR Integer (epoch time)
105
102
  def self.daterange(options={})
106
- if options.nil? || (options[:after].nil? && options[:before].nil?)
107
- raise ArguementError, "Missing proper parameters (:start_date or :end_date required)"
108
- end
109
-
110
- common_params(options)
103
+ # if options.nil? || (options[:after].nil? && options[:before].nil?)
104
+ # raise ArguementError, "Missing proper parameters (:start_date or :end_date required)"
105
+ # end
111
106
 
112
- Tigre.get_connection("/urls/daterange?after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
107
+ Tigre.logger.warn "** DEPRECATED ** Use Tigre::Url.index(options) " if Tigre.logger
108
+
109
+ self.index(options)
110
+ # common_params(options)
111
+ #
112
+ # Tigre.get_connection("/urls/daterange?after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
113
113
  end
114
114
 
115
115
  # required params
@@ -126,130 +126,8 @@ module Tigre
126
126
  end
127
127
 
128
128
  common_params(options)
129
- Tigre.get_connection("/urls/domains?domain=#{domain}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
130
- end
131
-
132
- # required params
133
- # tags => String => I.E 'foo'
134
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
135
- # tags => Array => ['foo', 'bar', 'baz']
136
- # optional params
137
- # options => Hash
138
- # :after => Ruby DateTime object OR Integer (epoch time)
139
- # :before => Ruby DateTime object OR Integer (epoch time)
140
- # :page => Integer, :default => 0
141
- # :per => Integer, :default => 50
142
- def self.tagged_with(tags, options={})
143
- if tags == ''
144
- raise "Missing tags parameter"
145
- end
146
-
147
- tags = package_array_list(tags)
148
- common_params(options)
149
- logic = get_logic_param(options[:logic])
150
- Tigre.get_connection("/urls/tagged_with?tags=#{tags}&logic=#{logic}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
151
- end
152
-
153
- # required params
154
- # hash => Hash
155
- # :digest => String, The digest type
156
- # :value => String, The digest value
157
- # :tag_list => String (comma seperated) => I.E 'foo,bar,baz'
158
- # :tag_list => Array => ['foo', 'bar', 'baz']
159
- def self.remove_tags(hash)
160
- unless hash[:digest] && hash[:value] && hash[:tag_list]
161
- raise 'Missing parameter :digest or :value or :tag_list'
162
- end
163
-
164
- update_data = {"tag_list" => package_array_list(hash[:tag_list])}
165
- Tigre.put_connection("/urls/#{hash[:digest]}/value/#{hash[:value]}/remove_tags", update_data)
166
- end
167
-
168
- # required params
169
- # tags => String => I.E 'foo'
170
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
171
- # tags => Array => ['foo', 'bar', 'baz']
172
- # optional params
173
- # options => Hash
174
- # :after => Ruby DateTime object OR Integer (epoch time)
175
- # :before => Ruby DateTime object OR Integer (epoch time)
176
- # :page => Integer, :default => 0
177
- # :per => Integer, :default => 50
178
- def self.not_tagged_with(tags, options={})
179
- if tags == ''
180
- raise "Missing tags parameter"
181
- end
182
-
183
- tags = package_array_list(tags)
184
- common_params(options)
185
- Tigre.get_connection("/urls/not_tagged_with?tags=#{tags}&after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
186
- end
187
-
188
- # optional params
189
- # options => Hash
190
- # :after => Ruby DateTime object OR Integer (epoch time)
191
- # :before => Ruby DateTime object OR Integer (epoch time)
192
- # :page => Integer, :default => 0
193
- # :per => Integer, :default => 50
194
- def self.not_tagged(options={})
195
- common_params(options)
196
- Tigre.get_connection("/urls/not_tagged?after=#{@after}&before=#{@before}&page=#{@page}&per=#{@per}")
197
- end
198
-
199
- # required
200
- # digest_hash => Hash
201
- # :digest => String, The digest type
202
- # :value => String, The digest value
203
- # optional params
204
- # params_hash => Hash
205
- # :dbts => Hash {:key1 => value, :key2 => value} where the key is what the name of the
206
- # attribute is and the value should be a boolean
207
- # :mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
208
- # :mutex_name_list => Array => ['foo', 'bar', 'baz']
209
- def self.add_analysis(digest_hash, params_hash={})
210
- unless digest_hash[:digest] && digest_hash[:value]
211
- raise 'Missing parameter :digest or :value'
212
- end
213
-
214
- if params_hash
215
- update_data = {}
216
- if params_hash[:mutex_name_list]
217
- params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list])
218
- end
219
-
220
- update_data["metadatas"] = params_hash
221
- end
222
-
223
- Tigre.put_connection("/urls/#{digest_hash[:digest]}/value/#{digest_hash[:value]}/analysis", update_data)
224
- end
225
-
226
- # optional params
227
- # options => Hash
228
- # :after => Ruby DateTime object OR Integer (epoch time)
229
- # :before => Ruby DateTime object OR Integer (epoch time)
230
- def self.count(options={})
231
- common_params(options)
232
- Tigre.get_connection("/urls/count?after=#{@after}&before=#{@before}")
233
- end
234
-
235
- # required params
236
- # tags => String => I.E 'foo'
237
- # tags => String (comma seperated) => I.E 'foo,bar,baz'
238
- # tags => Array => ['foo', 'bar', 'baz']
239
- # optional params
240
- # options => Hash
241
- # :after => Ruby DateTime object OR Integer (epoch time)
242
- # :before => Ruby DateTime object OR Integer (epoch time)
243
- def self.tagged_count(tags, options={})
244
- if tags == ''
245
- raise "Missing tags parameter"
246
- end
247
-
248
- tags = package_array_list(tags)
249
- common_params(options)
250
- Tigre.get_connection("/urls/tagged_with?tags=#{tags}&after=#{@after}&before=#{@before}")
129
+ Tigre.get_connection("/urls/domains?domain=#{domain}&#{before_after_page_per}")
251
130
  end
252
131
 
253
132
  end
254
-
255
133
  end
@@ -1,5 +1,5 @@
1
1
  module Tigre
2
2
  module Client
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
data/lib/tigre-client.rb CHANGED
@@ -1,12 +1,18 @@
1
+ # faraday
1
2
  require 'faraday'
2
-
3
3
  require 'tigre-client/multipart_with_file'
4
4
 
5
- require 'tigre-client/common_params'
5
+ # common functionality libraries
6
+ require 'tigre-client/common/analysis_components'
7
+ require 'tigre-client/common/common_getters'
8
+ require 'tigre-client/common/common_params'
9
+ require 'tigre-client/common/tag_components'
10
+
11
+ # public libraries
12
+ require 'tigre-client/analysis'
6
13
  require 'tigre-client/occurrence'
7
14
  require 'tigre-client/sample'
8
15
  require 'tigre-client/url'
9
- require 'tigre-client/analysis'
10
16
 
11
17
  module Tigre
12
18
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tigre-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.7
5
+ version: 0.3.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marcio Castilho
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-05-04 00:00:00 -04:00
14
+ date: 2011-05-05 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,10 @@ files:
65
65
  - Rakefile
66
66
  - lib/tigre-client.rb
67
67
  - lib/tigre-client/analysis.rb
68
- - lib/tigre-client/common_params.rb
68
+ - lib/tigre-client/common/analysis_components.rb
69
+ - lib/tigre-client/common/common_getters.rb
70
+ - lib/tigre-client/common/common_params.rb
71
+ - lib/tigre-client/common/tag_components.rb
69
72
  - lib/tigre-client/multipart_with_file.rb
70
73
  - lib/tigre-client/occurrence.rb
71
74
  - lib/tigre-client/sample.rb