Class: PromisePay::Session
- Inherits:
-
Object
- Object
- PromisePay::Session
- Defined in:
- lib/promise_pay/session.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#buyer_email ⇒ Object
Returns the value of attribute buyer_email.
-
#buyer_firstname ⇒ Object
Returns the value of attribute buyer_firstname.
-
#buyer_lastname ⇒ Object
Returns the value of attribute buyer_lastname.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#current_user_id ⇒ Object
Returns the value of attribute current_user_id.
-
#external_buyer_id ⇒ Object
Returns the value of attribute external_buyer_id.
-
#external_item_id ⇒ Object
Returns the value of attribute external_item_id.
-
#external_seller_id ⇒ Object
Returns the value of attribute external_seller_id.
-
#fee_ids ⇒ Object
Returns the value of attribute fee_ids.
-
#item_name ⇒ Object
Returns the value of attribute item_name.
-
#payment_type_id ⇒ Object
Returns the value of attribute payment_type_id.
-
#seller_email ⇒ Object
Returns the value of attribute seller_email.
-
#seller_firstname ⇒ Object
Returns the value of attribute seller_firstname.
-
#seller_lastname ⇒ Object
Returns the value of attribute seller_lastname.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Session
constructor
A new instance of Session.
- #request_token ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Session
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/promise_pay/session.rb', line 25 def initialize( = {}) @current_user_id = .fetch :current_user_id, nil @currency = .fetch :currency, nil @item_name = .fetch :item_name, nil @amount = .fetch :amount, nil @seller_lastname = .fetch :seller_lastname, nil @seller_firstname = .fetch :seller_firstname, nil @buyer_lastname = .fetch :buyer_lastname, nil @buyer_firstname = .fetch :buyer_firstname, nil @seller_email = .fetch :seller_email, nil @buyer_email = .fetch :buyer_email, nil @external_item_id = .fetch :external_item_id, nil @external_seller_id = .fetch :external_seller_id, nil @external_buyer_id = .fetch :external_buyer_id, nil @fee_ids = .fetch :fee_ids, nil @payment_type_id = .fetch :payment_type_id, nil @country_code = .fetch :country_code, nil end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
11 12 13 |
# File 'lib/promise_pay/session.rb', line 11 def amount @amount end |
#buyer_email ⇒ Object
Returns the value of attribute buyer_email.
17 18 19 |
# File 'lib/promise_pay/session.rb', line 17 def buyer_email @buyer_email end |
#buyer_firstname ⇒ Object
Returns the value of attribute buyer_firstname.
15 16 17 |
# File 'lib/promise_pay/session.rb', line 15 def buyer_firstname @buyer_firstname end |
#buyer_lastname ⇒ Object
Returns the value of attribute buyer_lastname.
14 15 16 |
# File 'lib/promise_pay/session.rb', line 14 def buyer_lastname @buyer_lastname end |
#country_code ⇒ Object
Returns the value of attribute country_code.
23 24 25 |
# File 'lib/promise_pay/session.rb', line 23 def country_code @country_code end |
#currency ⇒ Object
Returns the value of attribute currency.
9 10 11 |
# File 'lib/promise_pay/session.rb', line 9 def currency @currency end |
#current_user_id ⇒ Object
Returns the value of attribute current_user_id.
8 9 10 |
# File 'lib/promise_pay/session.rb', line 8 def current_user_id @current_user_id end |
#external_buyer_id ⇒ Object
Returns the value of attribute external_buyer_id.
20 21 22 |
# File 'lib/promise_pay/session.rb', line 20 def external_buyer_id @external_buyer_id end |
#external_item_id ⇒ Object
Returns the value of attribute external_item_id.
18 19 20 |
# File 'lib/promise_pay/session.rb', line 18 def external_item_id @external_item_id end |
#external_seller_id ⇒ Object
Returns the value of attribute external_seller_id.
19 20 21 |
# File 'lib/promise_pay/session.rb', line 19 def external_seller_id @external_seller_id end |
#fee_ids ⇒ Object
Returns the value of attribute fee_ids.
21 22 23 |
# File 'lib/promise_pay/session.rb', line 21 def fee_ids @fee_ids end |
#item_name ⇒ Object
Returns the value of attribute item_name.
10 11 12 |
# File 'lib/promise_pay/session.rb', line 10 def item_name @item_name end |
#payment_type_id ⇒ Object
Returns the value of attribute payment_type_id.
22 23 24 |
# File 'lib/promise_pay/session.rb', line 22 def payment_type_id @payment_type_id end |
#seller_email ⇒ Object
Returns the value of attribute seller_email.
16 17 18 |
# File 'lib/promise_pay/session.rb', line 16 def seller_email @seller_email end |
#seller_firstname ⇒ Object
Returns the value of attribute seller_firstname.
13 14 15 |
# File 'lib/promise_pay/session.rb', line 13 def seller_firstname @seller_firstname end |
#seller_lastname ⇒ Object
Returns the value of attribute seller_lastname.
12 13 14 |
# File 'lib/promise_pay/session.rb', line 12 def seller_lastname @seller_lastname end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/promise_pay/session.rb', line 7 def token @token end |
Instance Method Details
#request_token ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/promise_pay/session.rb', line 44 def request_token enforce_valid_params! request = PromisePay::Request.new(path: api_resource) response = request.execute @token = JSON.parse(response)["token"] token end |