class IletiMerkezi::Response

Response

Attributes

body[R]
code[R]
response[R]

Public Class Methods

new(response) click to toggle source
# File lib/ileti_merkezi/response.rb, line 14
def initialize(response)
  @response = response
  @code     = response.code.to_i
  @body     = response.body
end

Public Instance Methods

status() click to toggle source
# File lib/ileti_merkezi/response.rb, line 20
def status
  Status.find(code)
end
to_h() click to toggle source
# File lib/ileti_merkezi/response.rb, line 24
def to_h
  hash = Ox.load(
    body.force_encoding('utf-8'),
    mode: :hash
  )
  hash.fetch(:response, hash)
rescue Ox::ParseError
  {}
end
Also aliased as: to_hash
to_hash()
Alias for: to_h