tigre-client 0.2.2 → 0.2.3

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.2.1)
4
+ tigre-client (0.2.2)
5
5
  curb (~> 0.7.12)
6
6
  faraday (~> 0.6.0)
7
7
 
@@ -3,7 +3,7 @@ module Tigre
3
3
 
4
4
  # return all the occurrences for a given sha256 URL
5
5
  # required params
6
- # sha256 - String
6
+ # sha256 => String
7
7
  def self.for_sha(sha256)
8
8
  raise ArguementError, "Missing sha256 parameter" if sha256 == ''
9
9
  Tigre.get_connection("/urls/#{sha256}/occurrences")
@@ -11,8 +11,8 @@ module Tigre
11
11
 
12
12
  # return an individual occurrence for a given sha256 URL
13
13
  # required params
14
- # sha256 - String
15
- # occurrence_id - String
14
+ # sha256 => String
15
+ # occurrence_id => String
16
16
  def self.get(sha256, occurrence_id)
17
17
  raise ArguementError, "Missing sha256 or occurrence_id parameter" if (sha256 == '' || occurrence_id == '')
18
18
  Tigre.get_connection("/urls/#{sha256}/occurrences/#{occurrence_id}")
@@ -20,8 +20,8 @@ module Tigre
20
20
 
21
21
  # updated an individual occurrence for a given sha256 URL
22
22
  # required params
23
- # sha256 - String
24
- # occurrence_id - String
23
+ # sha256 => String
24
+ # occurrence_id => String
25
25
  def self.update(sha256, occurrence_id, params_hash={})
26
26
  raise ArguementError, "Missing sha256 parameter" if sha256 == ''
27
27
 
@@ -3,10 +3,10 @@ module Tigre
3
3
 
4
4
  # mimics a curl POST request using Curl
5
5
  # required params
6
- # file_location - String path to the file
7
- # md5 - String
6
+ # file_location => String path to the file
7
+ # md5 => String
8
8
  # optional params
9
- # options - Hash (reserved for future use)
9
+ # options => Hash (reserved for future use)
10
10
  def self.post(file_location, md5, options={})
11
11
  if file_location == ''|| md5 == ''
12
12
  raise ArguementError, "File_location or md5 parameter cannot be empty"
@@ -17,9 +17,9 @@ module Tigre
17
17
  end
18
18
 
19
19
  # optional params
20
- # options - Hash
21
- # :page - Integer, :default => 0
22
- # :per - Integer, :default => 50
20
+ # options => Hash
21
+ # :page => Integer, :default => 0
22
+ # :per => Integer, :default => 50
23
23
  def self.index(options={})
24
24
  options[:page] ||= 0
25
25
  options[:per] ||= 50
@@ -27,29 +27,49 @@ module Tigre
27
27
  end
28
28
 
29
29
  # required params
30
- # md5 - String
30
+ # md5 => String
31
31
  def self.update(md5, params_hash={})
32
32
  update_data = params_hash.map { |k, v| {"sample[#{k.to_s}]" => v.to_s} }
33
33
  Tigre.put_connection("/samples/#{md5}", update_data)
34
34
  end
35
35
 
36
36
  # required params
37
- # md5 - String
37
+ # md5 => String
38
38
  def self.md5(md5)
39
39
  Tigre.get_connection("/samples/md5/#{md5}")
40
40
  end
41
41
 
42
42
  # required params
43
- # sha1 - String
43
+ # sha1 => String
44
44
  def self.sha1(sha1)
45
45
  Tigre.get_connection("/samples/sha1/#{sha1}")
46
46
  end
47
47
 
48
48
  # required params
49
- # sha256 - String
49
+ # sha256 => String
50
50
  def self.sha256(sha256)
51
51
  Tigre.get_connection("/samples/sha256/#{sha256}")
52
52
  end
53
53
 
54
+ # required params
55
+ # tags => String => I.E 'foo'
56
+ # tags => String (comma seperated) => I.E 'foo,bar,baz'
57
+ # tags => Array => ['foo', 'bar', 'baz']
58
+ # optional params
59
+ # options => Hash
60
+ # :page => Integer, :default => 0
61
+ # :per => Integer, :default => 50
62
+ def self.tagged_with(tags, options={})
63
+ if tags == ''
64
+ raise ArguementError, "Missing tags parameter"
65
+ end
66
+
67
+ tags = tags.join(',') if tags.is_a?(Array)
68
+
69
+ options[:page] ||= 0
70
+ options[:per] ||= 50
71
+ Tigre.get_connection("/samples/tagged_with?tags=#{tags}&page=#{options[:page]}&per=#{options[:per]}")
72
+ end
73
+
54
74
  end
55
75
  end
@@ -2,12 +2,12 @@ module Tigre
2
2
  class Url
3
3
 
4
4
  # required params
5
- # url - String
6
- # options - Hash
7
- # :source_name - String
5
+ # url => String
6
+ # options => Hash
7
+ # :source_name => String
8
8
  # optional params
9
- # options - Hash
10
- # :shareable - Boolean, :default => false
9
+ # options => Hash
10
+ # :shareable => Boolean, :default => false
11
11
  def self.post(url, options={})
12
12
  if url == ''
13
13
  raise ArguementError, "Missing url parameter"
@@ -26,9 +26,9 @@ module Tigre
26
26
  end
27
27
 
28
28
  # required
29
- # sha256 - String
30
- # options - Hash
31
- # :source_name - String
29
+ # sha256 => String
30
+ # options => Hash
31
+ # :source_name => String
32
32
  def self.update(sha256, params_hash)
33
33
  if sha256 == ''
34
34
  raise ArguementError, "Missing url parameter"
@@ -39,7 +39,7 @@ module Tigre
39
39
  end
40
40
 
41
41
  # required params
42
- # sha256 - String
42
+ # sha256 => String
43
43
  def self.get(sha256)
44
44
  if sha256 == ''
45
45
  raise ArguementError, "Missing sha256 parameter"
@@ -48,7 +48,7 @@ module Tigre
48
48
  end
49
49
 
50
50
  # required params
51
- # sha256 - String
51
+ # sha256 => String
52
52
  def self.get_md5(md5)
53
53
  if md5 == ''
54
54
  raise ArguementError, "Missing md5 parameter"
@@ -57,9 +57,9 @@ module Tigre
57
57
  end
58
58
 
59
59
  # optional params
60
- # options - Hash
61
- # :page - Integer, :default => 0
62
- # :per - Integer, :default => 50
60
+ # options => Hash
61
+ # :page => Integer, :default => 0
62
+ # :per => Integer, :default => 50
63
63
  def self.index(options={})
64
64
  options[:page] ||= 0
65
65
  options[:per] ||= 50
@@ -67,7 +67,7 @@ module Tigre
67
67
  end
68
68
 
69
69
  # required params
70
- # options - Hash
70
+ # options => Hash
71
71
  # :after => Ruby DateTime object OR Integer (epoch time)
72
72
  # :before => Ruby DateTime object OR Integer (epoch time)
73
73
  def self.daterange(options={})
@@ -88,11 +88,13 @@ module Tigre
88
88
  end
89
89
 
90
90
  # required params
91
- # domain - String
91
+ # domain => String
92
92
  # optional params
93
- # options - Hash
93
+ # options => Hash
94
94
  # :after => Ruby DateTime object OR Integer (epoch time)
95
95
  # :before => Ruby DateTime object OR Integer (epoch time)
96
+ # :page => Integer, :default => 0
97
+ # :per => Integer, :default => 50
96
98
  def self.domains(domain, options={})
97
99
  if domain == ''
98
100
  raise ArguementError, "Missing domain parameter"
@@ -109,6 +111,27 @@ module Tigre
109
111
  options[:per] ||= 50
110
112
  Tigre.get_connection("/urls/domains?domain=#{domain}&after=#{options[:after]}&before=#{options[:before]}&page=#{options[:page]}&per=#{options[:per]}")
111
113
  end
114
+
115
+ # required params
116
+ # tags => String => I.E 'foo'
117
+ # tags => String (comma seperated) => I.E 'foo,bar,baz'
118
+ # tags => Array => ['foo', 'bar', 'baz']
119
+ # optional params
120
+ # options => Hash
121
+ # :page => Integer, :default => 0
122
+ # :per => Integer, :default => 50
123
+ def self.tagged_with(tags, options={})
124
+ if tags == ''
125
+ raise ArguementError, "Missing tags parameter"
126
+ end
127
+
128
+ tags = tags.join(',') if tags.is_a?(Array)
129
+
130
+ options[:page] ||= 0
131
+ options[:per] ||= 50
132
+ Tigre.get_connection("/urls/tagged_with?tags=#{tags}&page=#{options[:page]}&per=#{options[:per]}")
133
+ end
134
+
112
135
  end
113
136
 
114
137
  end
@@ -1,5 +1,5 @@
1
1
  module Tigre
2
2
  module Client
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tigre-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marcio Castilho