Class: WishSimple::Resource

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

Direct Known Subclasses

Action, Product, User

Constant Summary collapse

ATTRS =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/wishsimple/resource.rb', line 6

def created_at
  @created_at
end

Class Method Details

.create(*args) ⇒ Object



8
9
10
# File 'lib/wishsimple/resource.rb', line 8

def self.create(*args)
  new(*args).save
end

Instance Method Details

#destroyObject



17
18
19
20
# File 'lib/wishsimple/resource.rb', line 17

def destroy
  WishSimple.delete(path)
  self
end

#saveObject



12
13
14
15
# File 'lib/wishsimple/resource.rb', line 12

def save
  response = WishSimple.put(path, params)
  response.success? ? build_from_response(response) : self
end