tigre-client 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tigre-client/sample.rb +31 -8
- data/lib/tigre-client/version.rb +1 -1
- metadata +2 -2
data/lib/tigre-client/sample.rb
CHANGED
@@ -8,24 +8,47 @@ module Tigre
|
|
8
8
|
# optional params
|
9
9
|
# options - Hash (reserved for future use)
|
10
10
|
def self.post(file_location, md5, options={})
|
11
|
-
|
12
11
|
if file_location == ''|| md5 == ''
|
13
12
|
raise ArguementError, "File_location or md5 parameter cannot be empty"
|
14
13
|
end
|
15
14
|
|
16
15
|
c = Curl::Easy.new("#{Tigre.endpoint}/samples")
|
17
|
-
c.multipart_form_post
|
16
|
+
c.multipart_form_post = true
|
18
17
|
c.headers["API_TOKEN"] = Tigre.token
|
19
18
|
|
20
|
-
post_data = options.map {
|
21
|
-
|
22
|
-
post_data
|
23
|
-
post_data << Curl::PostField.content("md5", md5)
|
19
|
+
post_data = options.map {|k, v| Curl::PostField.content(k, v.to_s)}
|
20
|
+
post_data << Curl::PostField.file("file", file_location)
|
21
|
+
post_data << Curl::PostField.content("md5", md5)
|
24
22
|
|
25
23
|
c.http_post(*post_data)
|
26
|
-
|
27
24
|
return [c.response_code, c.body_str]
|
28
25
|
end
|
29
|
-
|
26
|
+
|
27
|
+
# required params
|
28
|
+
# md5 - String
|
29
|
+
def self.md5(md5)
|
30
|
+
c = Curl::Easy.new("#{Tigre.endpoint}/samples/md5/#{md5}")
|
31
|
+
c.headers["API_TOKEN"] = Tigre.token
|
32
|
+
c.perform
|
33
|
+
return [c.response_code, c.body_str]
|
34
|
+
end
|
35
|
+
|
36
|
+
# required params
|
37
|
+
# sha1 - String
|
38
|
+
def self.sha1(sha1)
|
39
|
+
c = Curl::Easy.new("#{Tigre.endpoint}/samples/sha1/#{sha1}")
|
40
|
+
c.headers["API_TOKEN"] = Tigre.token
|
41
|
+
c.perform
|
42
|
+
return [c.response_code, c.body_str]
|
43
|
+
end
|
44
|
+
|
45
|
+
# required params
|
46
|
+
# sha256 - String
|
47
|
+
def self.sha256(sha256)
|
48
|
+
c = Curl::Easy.new("#{Tigre.endpoint}/samples/sha256/#{sha256}")
|
49
|
+
c.headers["API_TOKEN"] = Tigre.token
|
50
|
+
c.perform
|
51
|
+
return [c.response_code, c.body_str]
|
52
|
+
end
|
30
53
|
end
|
31
54
|
end
|
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.0.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-03-
|
14
|
+
date: 2011-03-30 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|