Class: CcMe::CapturedRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/cc_me.rb

Overview

A decrypted delivery (the captured HTTP request).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, received_at_unix_ms:, method:, path:, query:, headers:, body_bytes:) ⇒ CapturedRequest

Returns a new instance of CapturedRequest.



201
202
203
204
205
206
207
208
209
# File 'lib/cc_me.rb', line 201

def initialize(id:, received_at_unix_ms:, method:, path:, query:, headers:, body_bytes:)
  @id = id
  @received_at_unix_ms = received_at_unix_ms
  @method = method
  @path = path
  @query = query
  @headers = headers
  @body_bytes = body_bytes
end

Instance Attribute Details

#body_bytesObject (readonly)

Returns the value of attribute body_bytes.



199
200
201
# File 'lib/cc_me.rb', line 199

def body_bytes
  @body_bytes
end

#headersObject (readonly)

Returns the value of attribute headers.



199
200
201
# File 'lib/cc_me.rb', line 199

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.



199
200
201
# File 'lib/cc_me.rb', line 199

def id
  @id
end

#methodObject (readonly)

Returns the value of attribute method.



199
200
201
# File 'lib/cc_me.rb', line 199

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



199
200
201
# File 'lib/cc_me.rb', line 199

def path
  @path
end

#queryObject (readonly)

Returns the value of attribute query.



199
200
201
# File 'lib/cc_me.rb', line 199

def query
  @query
end

#received_at_unix_msObject (readonly)

Returns the value of attribute received_at_unix_ms.



199
200
201
# File 'lib/cc_me.rb', line 199

def received_at_unix_ms
  @received_at_unix_ms
end

Instance Method Details

#jsonObject

Body parsed as JSON.



217
218
219
# File 'lib/cc_me.rb', line 217

def json
  JSON.parse(text)
end

#textObject

Body decoded as UTF-8.



212
213
214
# File 'lib/cc_me.rb', line 212

def text
  @body_bytes.dup.force_encoding(Encoding::UTF_8)
end