class RocketPaysRailsApi::Product
Attributes
description[RW]
Set description
name[RW]
Set name
quantity[RW]
Set quantity Should be greater than zero
unity_price[RW]
Set unit price Should be greater than zero
Public Class Methods
new(options = {})
click to toggle source
# File lib/rocket_pays_rails_api/product.rb, line 22 def initialize(options = {}) @description = options[:description] @name = options[:name] @unity_price = options[:unity_price] @quantity = options[:quantity] || 1 end
Public Instance Methods
to_hash()
click to toggle source
# File lib/rocket_pays_rails_api/product.rb, line 34 def to_hash { description: @description, name: @name, unityPrice: @unity_price.to_s, quantity: @quantity.to_s } end
to_json()
click to toggle source
Return json with data product
# File lib/rocket_pays_rails_api/product.rb, line 30 def to_json JSON.generate to_hash end