Sha256: 2ba41c0fe7405b46e4ea82414d41cf44ff1c003d18381b1ce27eedd1cf1784e9

Contents?: true

Size: 524 Bytes

Versions: 4

Compression:

Stored size: 524 Bytes

Contents

require 'active_support/ordered_options'
require 'forwardable'
require 'delegate'
require 'json'

module Kraken
  class Response < SimpleDelegator
    extend Forwardable

    def_delegators :@parsed, :success, :file_name, :original_size,
      :kraked_size, :saved_bytes, :kraked_url, :id, :message

    def initialize(response)
      super(response)
      @parsed = ActiveSupport::InheritableOptions.new(JSON.parse(response.body).with_indifferent_access)
    end

    alias_method :original_response, :__getobj__
  end
end

Version data entries

4 entries across 3 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/kraken-io-0.1.3/lib/kraken-io/response.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/kraken-io-0.1.3/lib/kraken-io/response.rb
kraken-io-0.1.3 lib/kraken-io/response.rb
kraken-io-0.1.2 lib/kraken-io/response.rb