Class: TiendaNube::Resource::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/tienda_nube/resource.rb

Direct Known Subclasses

Category, Customer, Product, ProductVariant

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.nameObject

Returns the value of attribute name.



67
68
69
# File 'lib/tienda_nube/resource.rb', line 67

def name
  @name
end

Class Method Details

.all(query = {}) ⇒ Object



69
70
71
# File 'lib/tienda_nube/resource.rb', line 69

def self.all(query={})
  Resource.get(self.name, query)
end

.create(data) ⇒ Object



78
79
80
# File 'lib/tienda_nube/resource.rb', line 78

def self.create(data)
  Resource.post(self.name, data)
end

.delete(id) ⇒ Object



75
76
77
# File 'lib/tienda_nube/resource.rb', line 75

def self.delete(id)
  Resource.delete("#{self.name}/#{id}")
end

.from_url(url) ⇒ Object



84
85
86
# File 'lib/tienda_nube/resource.rb', line 84

def self.from_url(url)
  Resource.get(url)
end

.get(id) ⇒ Object



72
73
74
# File 'lib/tienda_nube/resource.rb', line 72

def self.get(id)
  Resource.get("#{self.name}/#{id}")
end

.update(id, data) ⇒ Object



81
82
83
# File 'lib/tienda_nube/resource.rb', line 81

def self.update(id, data)
  Resource.put("#{self.name}/#{id}", data)
end