Module: Pin
- Defined in:
- lib/pin-payments.rb,
lib/pin-payments/base.rb,
lib/pin-payments/card.rb,
lib/pin-payments/charge.rb,
lib/pin-payments/refund.rb,
lib/pin-payments/customer.rb,
lib/pin-payments/response.rb
Defined Under Namespace
Classes: APIError, Base, Card, Charge, CollectionResponse, Customer, Error, Refund
Class Attribute Summary collapse
-
.auth ⇒ Object
readonly
Returns the value of attribute auth.
-
.base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
.js_url ⇒ Object
readonly
Returns the value of attribute js_url.
-
.publishable_key ⇒ Object
readonly
Returns the value of attribute publishable_key.
Class Method Summary collapse
Class Attribute Details
.auth ⇒ Object (readonly)
Returns the value of attribute auth.
29 30 31 |
# File 'lib/pin-payments.rb', line 29 def auth @auth end |
.base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
29 30 31 |
# File 'lib/pin-payments.rb', line 29 def base_url @base_url end |
.js_url ⇒ Object (readonly)
Returns the value of attribute js_url.
29 30 31 |
# File 'lib/pin-payments.rb', line 29 def js_url @js_url end |
.publishable_key ⇒ Object (readonly)
Returns the value of attribute publishable_key.
29 30 31 |
# File 'lib/pin-payments.rb', line 29 def publishable_key @publishable_key end |
Class Method Details
.setup(options) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pin-payments.rb', line 31 def setup() raise ArgumentError, "Pin.setup wants an options hash" unless Hash === raise ArgumentError, "no secret key configured" unless [:secret_key] raise ArgumentError, "no mode configured" unless [:mode] @auth = {username: [:secret_key], password: ''} @publishable_key = [:publishable_key] mode = [:mode].to_sym uri = if mode == :live "https://api.pin.net.au" elsif mode == :test "https://test-api.pin.net.au" else raise ArgumentError, "Incorrect API mode! Must be :live or :test" end @js_url = "#{uri}/pin.js" @base_url = "#{uri}/1" Pin::Base.base_uri "#{uri}/1" end |