Sha256: 1bf585188cb5c01908bb1122a8b5a5dbe0ea7dca1608b0b1a85fd5a598d92dcc

Contents?: true

Size: 898 Bytes

Versions: 10

Compression:

Stored size: 898 Bytes

Contents

module NitroPay
  class Status < NitroPay::Connection
    # Attrs
    attr_accessor :message # API response message
    attr_accessor :http_code # HTTP Code for the request
    attr_accessor :api_code # Internal system response code
    attr_accessor :response # the JSON retrieved

    # Constructor
    def initialize(params = {})
      super # call it super initialize
      self.path = 'status'
      check_it
    end

    # Check it status and 'setup' it attrs
    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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nitro_pay-1.0.10 lib/nitro_pay/status.rb
nitro_pay-1.0.9 lib/nitro_pay/status.rb
nitro_pay-1.0.8 lib/nitro_pay/status.rb
nitro_pay-1.0.7 lib/nitro_pay/status.rb
nitro_pay-1.0.6 lib/nitro_pay/status.rb
nitro_pay-1.0.4 lib/nitro_pay/status.rb
nitro_pay-1.0.3 lib/nitro_pay/status.rb
nitro_pay-1.0.2 lib/nitro_pay/status.rb
nitro_pay-1.0.1 lib/nitro_pay/status.rb
nitro_pay-1.0.0 lib/nitro_pay/status.rb