Class: Debitech::WebApi
- Inherits:
-
Object
- Object
- Debitech::WebApi
- Defined in:
- lib/debitech/web_api.rb
Constant Summary collapse
- APPROVED_REPLY =
"A"
Instance Method Summary collapse
- #approved_reply?(reply) ⇒ Boolean
- #form_action ⇒ Object
-
#form_fields ⇒ Object
you probably want to encode these when posting to dibs, for example HTMLEntities.new.encode(v, :named) (gem: htmlentities).
-
#initialize(opts = {}) ⇒ WebApi
constructor
A new instance of WebApi.
- #valid_response?(mac, sum, reply, verify_id) ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ WebApi
Returns a new instance of WebApi.
8 9 10 |
# File 'lib/debitech/web_api.rb', line 8 def initialize(opts = {}) @opts = opts end |
Instance Method Details
#approved_reply?(reply) ⇒ Boolean
25 26 27 |
# File 'lib/debitech/web_api.rb', line 25 def approved_reply?(reply) reply == APPROVED_REPLY end |
#form_action ⇒ Object
17 18 19 |
# File 'lib/debitech/web_api.rb', line 17 def form_action "https://securedt.dibspayment.com/verify/bin/#{@opts[:merchant]}/index" end |
#form_fields ⇒ Object
you probably want to encode these when posting to dibs, for example HTMLEntities.new.encode(v, :named) (gem: htmlentities)
13 14 15 |
# File 'lib/debitech/web_api.rb', line 13 def form_fields base_fields.merge(:MAC => request_mac) end |
#valid_response?(mac, sum, reply, verify_id) ⇒ Boolean
21 22 23 |
# File 'lib/debitech/web_api.rb', line 21 def valid_response?(mac, sum, reply, verify_id) response_mac(sum, reply, verify_id) == mac.upcase.split("=").last end |