Class: MoneyOnline::Request
- Inherits:
-
Object
- Object
- MoneyOnline::Request
- Defined in:
- lib/money_online/request.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params) ⇒ Request
constructor
A new instance of Request.
- #mapped_params ⇒ Object
- #params_valid? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(params) ⇒ Request
Returns a new instance of Request.
5 6 7 8 9 10 11 |
# File 'lib/money_online/request.rb', line 5 def initialize(params) @params = { :currency => "RUB" }.merge(params) raise ArgumentError, "MoneyOnline::Request requires amount, user_id, system_id, order_id and currency" unless params_valid? end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/money_online/request.rb', line 3 def params @params end |
Instance Method Details
#mapped_params ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/money_online/request.rb', line 13 def mapped_params { :project => MoneyOnline.config.project, :amount => params[:amount], :nickname => params[:user_id], :nick_extra => params[:user_extra], :mode_type => params[:system_id], :order_id => params[:order_id], :paymentCurrency => params[:currency] } end |
#params_valid? ⇒ Boolean
29 30 31 |
# File 'lib/money_online/request.rb', line 29 def params_valid? not [:amount, :user_id, :system_id, :order_id, :currency].any? { |attribute| params[attribute].blank? } end |
#url ⇒ Object
25 26 27 |
# File 'lib/money_online/request.rb', line 25 def url "http://www.onlinedengi.ru/wmpaycheck.php?#{MoneyOnline.build_query(mapped_params)}" end |