Class: Charger::Product

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/charger/product.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clientObject



41
42
43
# File 'lib/charger/product.rb', line 41

def self.client
  Charger.client
end

.find_by_product_family_id(id) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/charger/product.rb', line 29

def self.find_by_product_family_id id
  products = []
  client.get("product_families/#{id}/products") do |data|
    products << new(data['product'])
  end
  products
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/charger/product.rb', line 37

def persisted?
  !!id
end