Class: Conexa::Product

Inherits:
Model show all
Defined in:
lib/conexa/resources/product.rb

Overview

Product resource (read-only for listing/retrieving)

The new API v2 also supports POST /product and DELETE /product/:id.

Examples:

Find a product

product = Conexa::Product.find(100)
product.name  # => "Mensalidade"

List products

products = Conexa::Product.all(company_id: [3], limit: 50)

Create a product

product = Conexa::Product.create(name: 'Novo Produto', company_id: 3)

Delete a product

Conexa::Product.destroy(100)

Constant Summary

Constants inherited from ConexaObject

ConexaObject::RESOURCES

Instance Attribute Summary collapse

Attributes inherited from ConexaObject

#attributes

Method Summary

Methods inherited from Model

all, #class_name, class_name, #create, create, #destroy, destroy, extract_page_size_or_params, #fetch, find_by, find_by_id, #id, #primary_key, primary_key_attribute, #primary_key_name, #save, #set_primary_key, show_url, underscored_class_name, url

Methods included from Deprecatable

#deprecate

Methods inherited from ConexaObject

#==, #[]=, convert, #empty?, #initialize, #respond_to_missing?, #to_hash, #unsaved_attributes

Constructor Details

This class inherits a constructor from Conexa::ConexaObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Conexa::ConexaObject

Instance Attribute Details

#is_activeBoolean (readonly)

Returns Whether the product is active.

Returns:

  • (Boolean)

    Whether the product is active



28
29
30
# File 'lib/conexa/resources/product.rb', line 28

class Product < Model
  primary_key_attribute :product_id
end

#nameString (readonly)

Returns Product name.

Returns:

  • (String)

    Product name



28
29
30
# File 'lib/conexa/resources/product.rb', line 28

class Product < Model
  primary_key_attribute :product_id
end

#product_idInteger (readonly)

Returns Product ID (also accessible as #id).

Returns:

  • (Integer)

    Product ID (also accessible as #id)



28
29
30
# File 'lib/conexa/resources/product.rb', line 28

class Product < Model
  primary_key_attribute :product_id
end