Class: Razorpay::Product

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

Overview

Product API allows you to enable sub-merchants request for a product.

Constant Summary collapse

@@versions =
"v2"

Instance Attribute Summary

Attributes inherited from Entity

#attributes

Class 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

.edit(account_id, id, options = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/razorpay/product.rb', line 25

def self.edit(, id, options = {})
  if(!options.is_a?(String) && options.key?(:tnc_accepted))
    options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
  end
  request.patch "#{}/products/#{id}", options, @@versions
end

.fetch(account_id, id) ⇒ Object



21
22
23
# File 'lib/razorpay/product.rb', line 21

def self.fetch(, id)
  request.fetch "#{}/products/#{id}", @@versions
end

.fetch_tnc(productName) ⇒ Object



32
33
34
35
# File 'lib/razorpay/product.rb', line 32

def self.fetch_tnc(productName)
  r = request
  r.request :get, "/#{@@versions}/products/#{productName}/tnc", {}
end

.requestObject



10
11
12
# File 'lib/razorpay/product.rb', line 10

def self.request
  Razorpay::Request.new('accounts')
end

.request_product_configuration(account_id, options) ⇒ Object



14
15
16
17
18
19
# File 'lib/razorpay/product.rb', line 14

def self.request_product_configuration(, options)
  if(!options.is_a?(String) && options.key?(:tnc_accepted))
    options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
  end
  request.post "#{}/products", options, @@versions
end