Class: Paygate::Profile
- Inherits:
-
Object
- Object
- Paygate::Profile
- Defined in:
- lib/paygate/profile.rb
Constant Summary collapse
- PURCHASE_URL =
'https://service.paygate.net/INTL/pgtlProcess3.jsp'
Instance Attribute Summary collapse
-
#member ⇒ Object
Returns the value of attribute member.
-
#profile_no ⇒ Object
readonly
Returns the value of attribute profile_no.
Instance Method Summary collapse
-
#initialize(profile_no) ⇒ Profile
constructor
A new instance of Profile.
- #purchase(currency, amount) ⇒ Object
Constructor Details
#initialize(profile_no) ⇒ Profile
Returns a new instance of Profile.
13 14 15 |
# File 'lib/paygate/profile.rb', line 13 def initialize(profile_no) @profile_no = profile_no end |
Instance Attribute Details
#member ⇒ Object
Returns the value of attribute member.
11 12 13 |
# File 'lib/paygate/profile.rb', line 11 def member @member end |
#profile_no ⇒ Object (readonly)
Returns the value of attribute profile_no.
10 11 12 |
# File 'lib/paygate/profile.rb', line 10 def profile_no @profile_no end |
Instance Method Details
#purchase(currency, amount) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/paygate/profile.rb', line 17 def purchase(currency, amount) # Prepare params params = { profile_no: profile_no, mid: member.mid, goodcurrency: currency, unitprice: amount } params.compact! # Make request uri = URI(PURCHASE_URL) uri.query = ::URI.encode_www_form(params) response = ::Net::HTTP.get_response(uri) Response.build_from_net_http_response(:profile_pay, response) end |