Class: Razorpay::QrCode

Inherits:
Entity
  • Object
show all
Defined in:
lib/razorpay/qr_code.rb

Overview

QrCode API allows you to create, close and fetch QR codes

Instance Attribute Summary

Attributes inherited from Entity

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#initialize, #method_missing, #respond_to_missing?, #to_json, #with_a_bang

Constructor Details

This class inherits a constructor from Razorpay::Entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Razorpay::Entity

Class Method Details

.all(options = {}) ⇒ Object



22
23
24
# File 'lib/razorpay/qr_code.rb', line 22

def self.all(options = {})
  request.all options
end

.create(options) ⇒ Object



11
12
13
14
15
16
# File 'lib/razorpay/qr_code.rb', line 11

def self.create(options)
    if(!options.is_a?(String) && options.key?(:fixed_amount))
       options[:fixed_amount] = (options[:fixed_amount] ? 1 : 0)
    end  
  request.create options
end

.fetch(id) ⇒ Object



18
19
20
# File 'lib/razorpay/qr_code.rb', line 18

def self.fetch(id)
  request.fetch id
end

.requestObject



7
8
9
# File 'lib/razorpay/qr_code.rb', line 7

def self.request
  Razorpay::Request.new('payments/qr_codes')
end

Instance Method Details

#closeObject



30
31
32
# File 'lib/razorpay/qr_code.rb', line 30

def close
  self.class.request.post "#{id}/close"
end

#fetch_payments(options = {}) ⇒ Object



26
27
28
# File 'lib/razorpay/qr_code.rb', line 26

def fetch_payments(options = {})
  self.class.request.get "#{id}/payments", options
end