Class: VCR::ResponseStatus

Inherits:
Struct
  • Object
show all
Defined in:
lib/vcr/structs.rb

Overview

The response status of an HTTPInteraction.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeInteger

the HTTP status code

Returns:

  • (Integer)

    the current value of code



475
476
477
# File 'lib/vcr/structs.rb', line 475

def code
  @code
end

#messageString

the HTTP status message (e.g. "OK" for a status of 200)

Returns:

  • (String)

    the current value of message



475
476
477
# File 'lib/vcr/structs.rb', line 475

def message
  @message
end

Class Method Details

.from_hash(hash) ⇒ ResponseStatus

Constructs a new instance from a hash.

Parameters:

  • hash (Hash)

    the hash to use to construct the instance.

Returns:



491
492
493
# File 'lib/vcr/structs.rb', line 491

def self.from_hash(hash)
  new hash['code'], hash['message']
end

Instance Method Details

#to_hashHash

Builds a serializable hash from the response status data.

Returns:

  • (Hash)

    hash that represents this response status and can be easily serialized.

See Also:



481
482
483
484
485
# File 'lib/vcr/structs.rb', line 481

def to_hash
  {
    'code' => code, 'message' => message
  }
end