Sha256: 32ad9029f0bc4034c803d11f889830ed862c364a59f95f9f65a291144f5be9bf

Contents?: true

Size: 339 Bytes

Versions: 15

Compression:

Stored size: 339 Bytes

Contents

class Messenger::Result

  attr_reader :response

  def initialize(success, response)
    @success = success
    @response = response
  end

  def success?
    !!@success
  end

  def code
    response.code rescue nil
  end

  def body
    if response.respond_to?(:body)
      response.body
    else
      response.to_s
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
messenger-0.7.1 lib/messenger/result.rb
messenger-0.7.0 lib/messenger/result.rb
messenger-0.6.0 lib/messenger/result.rb
messenger-0.5.0 lib/messenger/result.rb
messenger-0.4.4 lib/messenger/result.rb
messenger-0.4.3 lib/messenger/result.rb
messenger-0.4.2 lib/messenger/result.rb
messenger-0.4.1 lib/messenger/result.rb
messenger-0.4.0 lib/messenger/result.rb
messenger-0.3.6 lib/messenger/result.rb
messenger-0.3.5 lib/messenger/result.rb
messenger-0.3.4 lib/messenger/result.rb
messenger-0.3.3 lib/messenger/result.rb
messenger-0.3.1 lib/messenger/result.rb
messenger-0.3.0 lib/messenger/result.rb