Module: Tigre
- Defined in:
- lib/tigre-client.rb,
lib/tigre-client/url.rb,
lib/tigre-client/scan.rb,
lib/tigre-client/sample.rb,
lib/tigre-client/version.rb,
lib/tigre-client/analysis.rb,
lib/tigre-client/occurrence.rb,
lib/tigre-client/common/common_params.rb,
lib/tigre-client/common/common_getters.rb,
lib/tigre-client/common/tag_components.rb,
lib/tigre-client/common/analysis_components.rb
Defined Under Namespace
Modules: AnalysisComponents, Client, CommonGetters, CommonParams, TagComponents Classes: Analysis, Occurrence, Sample, Scan, Url
Class Attribute Summary collapse
-
.conn ⇒ Object
Returns the value of attribute conn.
-
.endpoint ⇒ Object
Returns the value of attribute endpoint.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
-
.s3_key ⇒ Object
Returns the value of attribute s3_key.
-
.s3_secret ⇒ Object
Returns the value of attribute s3_secret.
-
.server ⇒ Object
Returns the value of attribute server.
-
.token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
- .build_get_connection ⇒ Object
- .build_post_connection ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .get_connection(uri_string) ⇒ Object
- .post_connection(uri_string, data) ⇒ Object
-
.put_connection(uri_string, data) ⇒ Object
TODO do we need a post_connection and a post_file_connection? def post_file_connection(uri_string, data) build_post_connection.
- .s3_enabled? ⇒ Boolean
Class Attribute Details
.conn ⇒ Object
Returns the value of attribute conn.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def conn @conn end |
.endpoint ⇒ Object
Returns the value of attribute endpoint.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def endpoint @endpoint end |
.logger ⇒ Object
Returns the value of attribute logger.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def logger @logger end |
.s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def s3_bucket @s3_bucket end |
.s3_key ⇒ Object
Returns the value of attribute s3_key.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def s3_key @s3_key end |
.s3_secret ⇒ Object
Returns the value of attribute s3_secret.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def s3_secret @s3_secret end |
.server ⇒ Object
Returns the value of attribute server.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def server @server end |
.token ⇒ Object
Returns the value of attribute token.
21 22 23 |
# File 'lib/tigre-client.rb', line 21 def token @token end |
Class Method Details
.build_get_connection ⇒ Object
32 33 34 35 36 |
# File 'lib/tigre-client.rb', line 32 def build_get_connection @conn = Faraday.new(:url => "#{Tigre.server}") do |builder| builder.adapter :net_http end end |
.build_post_connection ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/tigre-client.rb', line 38 def build_post_connection @conn = Faraday.new(:url => "#{Tigre.server}") do |builder| builder.use Faraday::Request::MultipartWithFile builder.use Faraday::Request::Multipart builder.use Faraday::Request::UrlEncoded builder.adapter :net_http end end |
.configure {|_self| ... } ⇒ Object
23 24 25 26 |
# File 'lib/tigre-client.rb', line 23 def configure yield self true end |
.get_connection(uri_string) ⇒ Object
47 48 49 50 51 |
# File 'lib/tigre-client.rb', line 47 def get_connection(uri_string) build_get_connection response = Tigre.conn.get(Tigre.endpoint + uri_string, 'API-TOKEN' => Tigre.token) [response.status, response.body] end |
.post_connection(uri_string, data) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/tigre-client.rb', line 53 def post_connection(uri_string, data) build_post_connection response = Tigre.conn.post do |req| req.url Tigre.endpoint + uri_string req.headers['API-TOKEN'] = Tigre.token req.body = data end [response.status, response.body] end |
.put_connection(uri_string, data) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/tigre-client.rb', line 75 def put_connection(uri_string, data) build_post_connection response = Tigre.conn.put do |req| req.url Tigre.endpoint + uri_string req.headers['API-TOKEN'] = Tigre.token req.body = data end [response.status, response.body] end |