Sha256: 791663583b1150576c5bef41f83f5a85fae5cd7c30c8ce1edc608ad4d5d44e21

Contents?: true

Size: 427 Bytes

Versions: 10

Compression:

Stored size: 427 Bytes

Contents

class Zencoder
  class Response < Zencoder

    attr_accessor :code, :body, :raw_body, :raw_response

    def initialize(options={})
      options.each do |k, v|
        send("#{k}=", v) if respond_to?("#{k}=")
      end
    end

    def success?
      code.to_i > 199 && code.to_i < 300
    end

    def errors
      if body.is_a?(Hash)
        Array(body['errors']).compact
      else
        []
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
zencoder-2.1.9 lib/zencoder/response.rb
zencoder-2.1.8 lib/zencoder/response.rb
zencoder-2.1.7 lib/zencoder/response.rb
zencoder-2.1.6 lib/zencoder/response.rb
zencoder-2.1.5 lib/zencoder/response.rb
zencoder-2.1.4 lib/zencoder/response.rb
zencoder-2.1.3 lib/zencoder/response.rb
zencoder-2.1.2 lib/zencoder/response.rb
zencoder-2.1.1 lib/zencoder/response.rb
zencoder-2.1.0 lib/zencoder/response.rb