class Upkey::Chatterly::Urls::Response

Attributes

contents[R]
status[R]

Public Class Methods

new(chatterly_response) click to toggle source
# File lib/upkey/chatterly/urls/response.rb, line 7
def initialize(chatterly_response)
  @status = chatterly_response.status

  case status
  when 200
    @contents = JSON.parse(chatterly_response.body)
  when 404
    @contents = { message: 'Requested URL not found.' }
  when 422
    @contents = { message: JSON.parse(chatterly_response.body) }
  when 401
    @contents = { message: 'You are unauthorized to access this. Please check your access credentials and try again.' }
  else
    raise ChatterlyError
  end
end