class ParichkiBg::Request::Transaction

Attributes

request_id[R]
type[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method ParichkiBg::Request::Base::new
# File lib/parichki_bg/request/transaction.rb, line 8
def initialize(attributes = {})
  super
  @request_id = attributes.fetch :request_id
end

Public Instance Methods

paid?() click to toggle source
pay_with_cash() click to toggle source
# File lib/parichki_bg/request/transaction.rb, line 26
def pay_with_cash
  @type = "cash"
  send
end
pay_with_points() click to toggle source
# File lib/parichki_bg/request/transaction.rb, line 31
def pay_with_points
  @type = "points"
  send
end
success?() click to toggle source
# File lib/parichki_bg/request/transaction.rb, line 36
def success?
  @response.code == "200" && !@response.body.match(/error/)
end
to_json() click to toggle source
# File lib/parichki_bg/request/transaction.rb, line 17
def to_json
  {
    amount:     amount.to_s,
    request_id: request_id.to_s,
    type:       type,
    pin:        pin
  }.to_json
end
uri() click to toggle source
# File lib/parichki_bg/request/transaction.rb, line 13
def uri
  URI "#{ParichkiBg::main_api_url}/#{user_id}/transactions?vendor_id=#{ParichkiBg::vendor_id}&signed_request=#{signed_request}"
end