Class: WishSimple::Action

Inherits:
Resource show all
Defined in:
lib/wishsimple/action.rb

Direct Known Subclasses

Purchase

Constant Summary

Constants inherited from Resource

Resource::ATTRS

Instance Attribute Summary collapse

Attributes inherited from Resource

#created_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

create, #destroy, #save

Constructor Details

#initialize(attrs = {}) ⇒ Action

Returns a new instance of Action.



11
12
13
14
# File 'lib/wishsimple/action.rb', line 11

def initialize(attrs={})
  self.user = attrs[:user]
  self.product = attrs[:product]
end

Instance Attribute Details

#productObject

Returns the value of attribute product.



5
6
7
# File 'lib/wishsimple/action.rb', line 5

def product
  @product
end

#userObject

Returns the value of attribute user.



5
6
7
# File 'lib/wishsimple/action.rb', line 5

def user
  @user
end

Class Method Details

.verbObject



7
8
9
# File 'lib/wishsimple/action.rb', line 7

def self.verb
  name.split('::')[-1].downcase.to_sym
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/wishsimple/action.rb', line 16

def ==(other)
  super || (
    other.class == self.class \
      && other.user == self.user \
      && other.product == self.product
  )
end