Class: LucidIntercom::Response

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/lucid_intercom/response.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

ClientError =
Class.new(Error)
ServerError =
Class.new(Error)

Instance Method Summary collapse

Instance Method Details

#assert!self

Returns:

  • (self)

Raises:



62
63
64
65
66
67
68
69
70
71
# File 'lib/lucid_intercom/response.rb', line 62

def assert!
  case status_code
  when 400..499
    raise ClientError.new(self)
  when 500..599
    raise ServerError.new(self)
  end

  self
end

#dataString

Returns:

  • (String)


36
# File 'lib/lucid_intercom/response.rb', line 36

param :data

#data_hashHash

Returns the parsed response body.

Returns:

  • (Hash)

    the parsed response body



38
# File 'lib/lucid_intercom/response.rb', line 38

param :data_hash, default: -> { parse_data }

#headersHash

Returns:

  • (Hash)


34
# File 'lib/lucid_intercom/response.rb', line 34

param :headers

#status_codeInteger

Returns:

  • (Integer)


32
# File 'lib/lucid_intercom/response.rb', line 32

param :status_code