Class: CapsuleCRM::Opportunity

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations, Associations, Persistence::Deletable, Persistence::Persistable, Querying::Findable, Serializable
Defined in:
lib/capsule_crm/opportunity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Serializable

included, #serializer, #to_capsule_json

Methods included from Persistence::Deletable

#build_destroy_path, #destroy

Methods included from Persistence::Persistable

#build_create_path, #build_update_path, #create_record, included, #new_record?, #persisted?, #save, #save!, #update_attributes, #update_attributes!, #update_record

Methods included from Querying::Findable

included

Instance Attribute Details

#milestoneObject

Returns the value of attribute milestone.



43
44
45
# File 'lib/capsule_crm/opportunity.rb', line 43

def milestone
  @milestone
end

#ownerObject

Returns the value of attribute owner.



43
44
45
# File 'lib/capsule_crm/opportunity.rb', line 43

def owner
  @owner
end

Class Method Details

._for_track(track) ⇒ Object

Raises:

  • (NotImplementedError)


67
68
69
# File 'lib/capsule_crm/opportunity.rb', line 67

def self._for_track(track)
  raise NotImplementedError.new("There is no way to find opportunities by trackId in the Capsule API right now")
end

.deleted(since) ⇒ Object

Public: Get all deleted opportunities since the specified date

since - The Date to start checking for deleted opportunities

Examples

CapsuleCRM::Opportunity.deleted(1.week.ago)

Returns a ResultsProxy of opportunities



80
81
82
83
84
85
86
# File 'lib/capsule_crm/opportunity.rb', line 80

def self.deleted(since)
  CapsuleCRM::Normalizer.new(
    self, root: 'deletedOpportunity', collection_root: 'deletedOpportunities'
  ).normalize_collection(
    CapsuleCRM::Connection.get('/api/opportunity/deleted', since: since)
  )
end