Sha256: f121a8ca2e562fe88b42bd9705db6b19bc9dd8c2fe536626aaedb2997c852faa
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
module Paid class Product < APIResource attr_reader :id attr_reader :object attr_accessor :description attr_accessor :external_id attr_accessor :external_metric_id attr_accessor :name attr_accessor :transaction_description attr_accessor :pricing_structure def self.all(params={}, headers={}) method = APIMethod.new(:get, "/products", params, headers, self) APIList.new(self, method.execute, method) end def self.retrieve(id, params={}, headers={}) params = ParamsBuilder.merge(params, { :id => id }) method = APIMethod.new(:get, "/products/:id", params, headers, self) self.new(method.execute, method) end def self.create(params={}, headers={}) method = APIMethod.new(:post, "/products", params, headers, self) self.new(method.execute, method) end def refresh(params={}, headers={}) method = APIMethod.new(:get, "/products/:id", params, headers, self) self.refresh_from(method.execute, method) end def save(params={}, headers={}) params = ParamsBuilder.merge(params, changed_api_attributes) method = APIMethod.new(:put, "/products/:id", params, headers, self) self.refresh_from(method.execute, method) end APIResource.register_api_subclass(self, "product") @api_attributes = { :id => { :readonly => true }, :object => { :readonly => true }, :description => nil, :external_id => nil, :external_metric_id => nil, :name => nil, :transaction_description => nil, :pricing_structure => nil } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
paid-1.2.1 | lib/paid/product.rb |
paid-1.2.0 | lib/paid/product.rb |
paid-1.1.4 | lib/paid/product.rb |
paid-1.1.3 | lib/paid/product.rb |