Class: BucketStatsRequest
- Inherits:
-
Object
- Object
- BucketStatsRequest
- Defined in:
- lib/bstat2google/bucket_stats_request.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(attrs = {}) ⇒ BucketStatsRequest
constructor
A new instance of BucketStatsRequest.
- #url ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ BucketStatsRequest
Returns a new instance of BucketStatsRequest.
4 5 6 |
# File 'lib/bstat2google/bucket_stats_request.rb', line 4 def initialize(attrs = {}) attrs.each {|k,v| self.send("#{k}=", v)} end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
2 3 4 |
# File 'lib/bstat2google/bucket_stats_request.rb', line 2 def api @api end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/bstat2google/bucket_stats_request.rb', line 2 def id @id end |
Instance Method Details
#get ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bstat2google/bucket_stats_request.rb', line 8 def get response = api.get url, content_type: :json, accept: :json if response.code >= 200 and response.code < 300 return Response.new(code: response.code, payload: JSON.parse(response.body)) else return Response.new(code: response.code, payload: response.description) end rescue Exception => e puts e. puts e.backtrace.join("\n") return Response.new(code: 0, payload: e.) end |
#url ⇒ Object
21 22 23 |
# File 'lib/bstat2google/bucket_stats_request.rb', line 21 def url "#{api.end_point}/case_blocks/bucket_stats/#{id}.json?auth_token=#{api.auth_token}" end |