class Fitting::Records::Spherical::Response

Attributes

body[R]
status[R]

Public Class Methods

load(hash) click to toggle source
# File lib/fitting/records/spherical/response.rb, line 31
def load(hash)
  new(status: hash['status'], body: hash['body'])
end
new(status:, body:) click to toggle source
# File lib/fitting/records/spherical/response.rb, line 9
def initialize(status:, body:)
  @status = status
  @body = body
end

Public Instance Methods

to_hash() click to toggle source
# File lib/fitting/records/spherical/response.rb, line 14
def to_hash
  {
    status: status,
    body: JSON.load(body)
  }
rescue JSON::ParserError
  {
    status: status,
    body: {}
  }
end
to_json() click to toggle source
# File lib/fitting/records/spherical/response.rb, line 26
def to_json
  JSON.dump(to_hash)
end