Sha256: 9c73c0a57a115249498ad65c149c073f313ded2b64b560177346582b012d8a53

Contents?: true

Size: 357 Bytes

Versions: 8

Compression:

Stored size: 357 Bytes

Contents

module Spyke
  class Result
    attr_reader :body

    def self.new_from_response(response)
      new(response.body)
    end

    def initialize(body)
      @body = HashWithIndifferentAccess.new(body)
    end

    def data
      body[:data]
    end

    def metadata
      body[:metadata] || {}
    end

    def errors
      body[:errors]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spyke-1.2.1 lib/spyke/result.rb
spyke-1.2.0 lib/spyke/result.rb
spyke-1.1.2 lib/spyke/result.rb
spyke-1.1.1 lib/spyke/result.rb
spyke-1.1.0 lib/spyke/result.rb
spyke-1.0.2 lib/spyke/result.rb
spyke-1.0.1 lib/spyke/result.rb
spyke-1.0.0 lib/spyke/result.rb