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_analysis_bucket ⇒ Object
Returns the value of attribute s3_analysis_bucket.
-
.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_analysis_enabled? ⇒ Boolean
- .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_analysis_bucket ⇒ Object
Returns the value of attribute s3_analysis_bucket.
22 23 24 |
# File 'lib/tigre-client.rb', line 22 def s3_analysis_bucket @s3_analysis_bucket end |
.s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
22 23 24 |
# File 'lib/tigre-client.rb', line 22 def s3_bucket @s3_bucket end |
.s3_key ⇒ Object
Returns the value of attribute s3_key.
22 23 24 |
# File 'lib/tigre-client.rb', line 22 def s3_key @s3_key end |
.s3_secret ⇒ Object
Returns the value of attribute s3_secret.
22 23 24 |
# File 'lib/tigre-client.rb', line 22 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
37 38 39 40 41 |
# File 'lib/tigre-client.rb', line 37 def build_get_connection @conn = Faraday.new(:url => "#{Tigre.server}") do |builder| builder.adapter :net_http end end |
.build_post_connection ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/tigre-client.rb', line 43 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
24 25 26 27 |
# File 'lib/tigre-client.rb', line 24 def configure yield self true end |
.get_connection(uri_string) ⇒ Object
52 53 54 55 56 |
# File 'lib/tigre-client.rb', line 52 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
58 59 60 61 62 63 64 65 66 |
# File 'lib/tigre-client.rb', line 58 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
80 81 82 83 84 85 86 87 88 |
# File 'lib/tigre-client.rb', line 80 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 |