Class: Razorpay::Item

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

Overview

Item API allows you to create and fetch customers on Razorpay

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

.all(options = {}) ⇒ Object



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

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

.create(options) ⇒ Object



11
12
13
# File 'lib/razorpay/item.rb', line 11

def self.create(options)
  request.create options
end

.delete(id) ⇒ Object



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

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

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



19
20
21
22
23
24
# File 'lib/razorpay/item.rb', line 19

def self.edit(id, options = {})
  if(!options.is_a?(String) && options.key?(:active))
    options[:active] = (options[:active] ? 1 : 0)
  end 
  request.patch id, options
end

.fetch(id) ⇒ Object



15
16
17
# File 'lib/razorpay/item.rb', line 15

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

.requestObject



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

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