tigre-client 0.0.9 → 0.1.0

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tigre-client (0.0.8)
4
+ tigre-client (0.0.9)
5
5
  curb (~> 0.7.12)
6
6
 
7
7
  GEM
data/lib/tigre-client.rb CHANGED
@@ -1,6 +1,7 @@
1
- require 'tigre-client/url'
2
- require 'tigre-client/sample'
3
1
  require 'curb'
2
+ require 'tigre-client/occurrence'
3
+ require 'tigre-client/sample'
4
+ require 'tigre-client/url'
4
5
 
5
6
  module Tigre
6
7
 
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Tigre
2
2
  module Client
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
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.0.9
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-30 00:00:00 -04:00
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