tigre-client 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/tigre-client.rb +3 -2
- data/lib/tigre-client/occurrence.rb +39 -0
- data/lib/tigre-client/url.rb +0 -3
- data/lib/tigre-client/version.rb +1 -1
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/lib/tigre-client.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
module Tigre
|
2
|
+
class Occurrence
|
3
|
+
|
4
|
+
# return all the occurrences for a given sha256 URL
|
5
|
+
# required params
|
6
|
+
# sha256 - String
|
7
|
+
def self.for_sha(sha256)
|
8
|
+
|
9
|
+
if sha256 == ''
|
10
|
+
raise ArguementError, "Missing sha256 parameter"
|
11
|
+
end
|
12
|
+
|
13
|
+
c = Curl::Easy.new("#{Tigre.endpoint}/urls/#{sha256}/occurrences")
|
14
|
+
c.multipart_form_post = false
|
15
|
+
c.headers["API-TOKEN"] = Tigre.token
|
16
|
+
|
17
|
+
c.perform
|
18
|
+
return [c.response_code, c.body_str]
|
19
|
+
end
|
20
|
+
|
21
|
+
# return an individual occurrence for a given sha256 URL
|
22
|
+
# required params
|
23
|
+
# sha256 - String
|
24
|
+
# occurrence_id - String
|
25
|
+
def self.get(sha256, occurrence_id)
|
26
|
+
if sha256 == '' || occurrence_id == ''
|
27
|
+
raise ArguementError, "Missing sha256 or occurrence_id parameter"
|
28
|
+
end
|
29
|
+
|
30
|
+
c = Curl::Easy.new("#{Tigre.endpoint}/urls/#{sha256}/occurrences/#{occurrence_id}")
|
31
|
+
c.multipart_form_post = false
|
32
|
+
c.headers["API-TOKEN"] = Tigre.token
|
33
|
+
|
34
|
+
c.perform
|
35
|
+
return [c.response_code, c.body_str]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/lib/tigre-client/url.rb
CHANGED
@@ -27,9 +27,6 @@ module Tigre
|
|
27
27
|
}
|
28
28
|
post_data = fields_hash.map { |k, v| Curl::PostField.content(k, v.to_s) }
|
29
29
|
|
30
|
-
puts post_data
|
31
|
-
puts post_data.inspect
|
32
|
-
|
33
30
|
c = Curl::Easy.new("#{Tigre.endpoint}/urls")
|
34
31
|
c.multipart_form_post = false
|
35
32
|
c.headers["API-TOKEN"] = Tigre.token
|
data/lib/tigre-client/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tigre-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
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-03-
|
14
|
+
date: 2011-03-31 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- Gemfile.lock
|
54
54
|
- Rakefile
|
55
55
|
- lib/tigre-client.rb
|
56
|
+
- lib/tigre-client/occurrence.rb
|
56
57
|
- lib/tigre-client/sample.rb
|
57
58
|
- lib/tigre-client/url.rb
|
58
59
|
- lib/tigre-client/version.rb
|