Module: SwipeHQ
- Extended by:
- SwipeHQ
- Included in:
- SwipeHQ
- Defined in:
- lib/swipehq.rb,
lib/swipehq/version.rb,
lib/swipehq/transaction.rb
Defined Under Namespace
Classes: Transaction
Constant Summary collapse
- LIB_PATH =
File.dirname(__FILE__) + '/swipehq/'
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #request(method = :get, url, params) ⇒ Object
- #set_callback_url ⇒ Object
- #set_lpn_url ⇒ Object
Instance Method Details
#configure {|_self| ... } ⇒ Object
13 14 15 |
# File 'lib/swipehq.rb', line 13 def configure yield self end |
#request(method = :get, url, params) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/swipehq.rb', line 27 def request(method = :get, url, params) raw_response = RestClient.send(method, url, params: params) if raw_response JSON.parse(raw_response) else nil end end |
#set_callback_url ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/swipehq.rb', line 36 def set_callback_url return nil unless callback_url params = { api_key: SwipeHQ.api_key, merchant_id: SwipeHQ.merchant_id, callback_url: callback_url } url = 'https://api.swipehq.com/setCallback.php' request(:post, url, params: params) end |
#set_lpn_url ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/swipehq.rb', line 47 def set_lpn_url return nil unless lpn_url params = { api_key: SwipeHQ.api_key, merchant_id: SwipeHQ.merchant_id, lpn_url: lpn_url } url = 'https://api.swipehq.com/setCallback.php' request(:post, url, params: params) end |