class NitroPay::Status

Attributes

api_code[RW]
http_code[RW]
message[RW]

Attrs

response[RW]

Public Class Methods

new(params = {}) click to toggle source

Constructor

Calls superclass method NitroPay::Connection::new
# File lib/nitro_pay/status.rb, line 10
def initialize(params = {})
  super # call it super initialize
  self.path = 'status'
  check_it
end

Public Instance Methods

check_it() click to toggle source

Check it status and ‘setup’ it attrs

# File lib/nitro_pay/status.rb, line 17
def check_it
  self.path = 'status'
  resp = get_request
  hash_resp = JSON.parse(resp).it_keys_to_sym
  self.http_code = resp.code
  self.message = "EndPoint not response(connection error): #{self.url_requested}" if self.http_code != 200
  self.message = hash_resp[:message] if self.http_code == 200
  self.api_code = hash_resp[:api_code]
  self.response = hash_resp
  self
end