Class: Rubyplat::Client
- Inherits:
-
Object
- Object
- Rubyplat::Client
- Defined in:
- lib/rubyplat/client.rb
Constant Summary collapse
- InvalidSignature =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(key = Rubyplat.config.key, pubkey = Rubyplat.config.pubkey) ⇒ Client
constructor
A new instance of Client.
- #pay(params = {}, vendor_or_uri) ⇒ Object
- #pay_check(params = {}, vendor_or_uri) ⇒ Rubyplat::Responses::PaymentPermissionResponse, Net::HTTPBadRequest
- #pay_status(params = {}, vendor_or_uri) ⇒ Object
Constructor Details
#initialize(key = Rubyplat.config.key, pubkey = Rubyplat.config.pubkey) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/rubyplat/client.rb', line 7 def initialize(key=Rubyplat.config.key, pubkey=Rubyplat.config.pubkey) @key, @pubkey = key, pubkey end |
Instance Method Details
#pay(params = {}, vendor_or_uri) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/rubyplat/client.rb', line 33 def pay(params = {}, vendor_or_uri) uri = vendor_or_uri.kind_of?(String) ? URI(vendor_or_uri) : vendor_or_uri.pay_check_uri request = Rubyplat::Requests::PaymentRequest.new(params) response = send_request(request, uri) read_response(response, Rubyplat::Responses::PaymentResponse) end |
#pay_check(params = {}, vendor_or_uri) ⇒ Rubyplat::Responses::PaymentPermissionResponse, Net::HTTPBadRequest
25 26 27 28 29 30 31 |
# File 'lib/rubyplat/client.rb', line 25 def pay_check(params = {}, vendor_or_uri) uri = vendor_or_uri.kind_of?(String) ? URI(vendor_or_uri) : vendor_or_uri.pay_check_uri request = Rubyplat::Requests::PaymentPermission.new(params) response = send_request(request, uri) read_response(response, Rubyplat::Responses::PaymentPermissionResponse) end |
#pay_status(params = {}, vendor_or_uri) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/rubyplat/client.rb', line 41 def pay_status(params = {}, vendor_or_uri) uri = vendor_or_uri.kind_of?(String) ? URI(vendor_or_uri) : vendor_or_uri.pay_check_uri request = Rubyplat::Requests::PaymentStatus.new(params) response = send_request(request, uri) read_response(response, Rubyplat::Responses::PaymentStatusResponse) end |