Sha256: 2abc20a54942a7b7a49fc88a71fcc2b69b8bec0e73d133f3a55f172aafd40083
Contents?: true
Size: 771 Bytes
Versions: 7
Compression:
Stored size: 771 Bytes
Contents
module Carbon class EmissionEstimate class Storage attr_accessor :parent attr_reader :raw_request attr_reader :raw_response def initialize(parent) @parent = parent end def url "#{::Carbon::STORAGE_URL}/#{::Digest::SHA1.hexdigest(parent.key+parent.guid)}" end def present? parent.guid.present? and data.present? end def data return @data[0] if @data.is_a? ::Array @raw_request = ::REST::Request.new :get, ::URI.parse(url) @raw_response = raw_request.perform if raw_response.success? @data = [::Carbon::EmissionEstimate.parse(raw_response.body)] else @data = [] end @data[0] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems