Sha256: fbb420d3fd24518f17a24bb6f6fa16615e4427a6f28f529c119e2bd05e254caa

Contents?: true

Size: 326 Bytes

Versions: 15

Compression:

Stored size: 326 Bytes

Contents

require 'json'
require 'hashie/dash'

module Lurker
  class Response < Hashie::Dash
    property :status, required: true
    property :body, default: {}

    def self.build_from_action_dispatch(response)
      new(
        status: response.status,
        body: (JSON.parse(response.body) rescue {})
      )
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lurker-1.0.0 lib/lurker/response.rb
lurker-0.6.12 lib/lurker/response.rb
lurker-0.6.11 lib/lurker/response.rb
lurker-0.6.10 lib/lurker/response.rb
lurker-0.6.9 lib/lurker/response.rb
lurker-0.6.8 lib/lurker/response.rb
lurker-0.6.7 lib/lurker/response.rb
lurker-0.6.6 lib/lurker/response.rb
lurker-0.6.5 lib/lurker/response.rb
lurker-0.6.4 lib/lurker/response.rb
lurker-0.6.3 lib/lurker/response.rb
lurker-0.6.2 lib/lurker/response.rb
lurker-0.6.1 lib/lurker/response.rb
lurker-0.5.7 lib/lurker/response.rb
lurker-0.6.0 lib/lurker/response.rb