Class: MOCO::Deal

Inherits:
BaseEntity show all
Defined in:
lib/moco/entities/deal.rb

Overview

Represents a MOCO deal Provides methods for deal-specific associations

Instance Attribute Summary

Attributes inherited from BaseEntity

#attributes, #client

Instance Method Summary collapse

Methods inherited from BaseEntity

#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update

Constructor Details

This class inherits a constructor from MOCO::BaseEntity

Instance Method Details

#categoryObject



16
17
18
# File 'lib/moco/entities/deal.rb', line 16

def category
  association(:category, "DealCategory")
end

#companyObject

Associations



8
9
10
# File 'lib/moco/entities/deal.rb', line 8

def company
  association(:company) || association(:customer, "Company")
end

#to_sObject



20
21
22
# File 'lib/moco/entities/deal.rb', line 20

def to_s
  "#{name} (#{company&.name})"
end

#userObject



12
13
14
# File 'lib/moco/entities/deal.rb', line 12

def user
  association(:user)
end