Class: Insightly::OpportunityStateReason
- Defined in:
- lib/insightly/opportunity_state_reason.rb
Constant Summary collapse
- STATES =
["Abandoned", "Lost", "Open", "Suspended", "Won"]
Class Method Summary collapse
Methods inherited from ReadOnly
#==, #build, build, #config, #get_collection, #initialize, #process, #remote_data
Methods inherited from Base
#==, all, api_field, #build, build, #config, custom_fields, #get_collection, #initialize, #load, #process, #reload, #remote_data, #remote_id, #to_json, #url_base
Constructor Details
This class inherits a constructor from Insightly::ReadOnly
Class Method Details
.find_by_state(state) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/insightly/opportunity_state_reason.rb', line 10 def self.find_by_state(state) list = [] OpportunityStateReason.all.each.each do |x| if x.for_opportunity_state && x.for_opportunity_state.match(state) list << x end end list end |
.find_by_state_reason(state, reason) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/insightly/opportunity_state_reason.rb', line 20 def self.find_by_state_reason(state,reason) OpportunityStateReason.all.each.each do |x| return x if x.for_opportunity_state && x.for_opportunity_state.match(state) && x.state_reason == reason end nil end |