Class: Fonepaisa::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fonepaisa/client.rb

Direct Known Subclasses

PaymentRequestURL

Constant Summary collapse

BASE_URL =
'https://api.fonepaisa.com/v2'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/fonepaisa/client.rb', line 10

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/fonepaisa/client.rb', line 6

def params
  @params
end

Instance Method Details

#response_valid?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
# File 'lib/fonepaisa/client.rb', line 14

def response_valid?
  # if hash field is nil then no need to verify response params
  return true if params[:hash].nil?

  attributes = params.dup
  attributes.delete(:hash)
  hash_key = secure_hash_key(attributes)

  hash_key == params[:hash]
end