Class: Jiminy::Reporting::CIProviders::CircleCI::Base
- Inherits:
-
Object
- Object
- Jiminy::Reporting::CIProviders::CircleCI::Base
- Defined in:
- lib/jiminy/reporting/ci_providers/circle_ci/base.rb
Class Attribute Summary collapse
-
.next_token ⇒ Object
Returns the value of attribute next_token.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
39 40 41 |
# File 'lib/jiminy/reporting/ci_providers/circle_ci/base.rb', line 39 def initialize(attributes = {}) @attributes = attributes.transform_keys!(&:to_s) end |
Class Attribute Details
.next_token ⇒ Object
Returns the value of attribute next_token.
23 24 25 |
# File 'lib/jiminy/reporting/ci_providers/circle_ci/base.rb', line 23 def next_token @next_token end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14 15 16 |
# File 'lib/jiminy/reporting/ci_providers/circle_ci/base.rb', line 14 def attributes @attributes end |
Class Method Details
.define_attribute_readers(*attr_names) ⇒ Object
16 17 18 19 20 |
# File 'lib/jiminy/reporting/ci_providers/circle_ci/base.rb', line 16 def self.define_attribute_readers(*attr_names) attr_names.each do |attr_name| define_method(attr_name, -> { attributes[__callee__.to_s] }) end end |
.fetch_api_resource(path) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/jiminy/reporting/ci_providers/circle_ci/base.rb', line 30 def self.fetch_api_resource(path) response = APIRequest.new(path).perform! raise "Error response: #{response.body}" unless response.is_a?(Net::HTTPOK) json_body = JSON.parse(response.read_body) self.next_token = json_body["next_page_token"] json_body["items"].map { |attributes| new(attributes) } end |