Class: CapsuleCRM::Opportunity
- Defined in:
- lib/capsulecrm/opportunity.rb
Instance Attribute Summary collapse
-
#actual_close_date ⇒ Object
Returns the value of attribute actual_close_date.
-
#created_on ⇒ Object
Returns the value of attribute created_on.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#duration_basis ⇒ Object
Returns the value of attribute duration_basis.
-
#expected_close_date ⇒ Object
Returns the value of attribute expected_close_date.
-
#milestone ⇒ Object
Returns the value of attribute milestone.
-
#name ⇒ Object
Returns the value of attribute name.
-
#party_id ⇒ Object
Returns the value of attribute party_id.
-
#probability ⇒ Object
Returns the value of attribute probability.
-
#updated_on ⇒ Object
Returns the value of attribute updated_on.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Base
Class Method Summary collapse
-
.get_path ⇒ Object
nodoc.
-
.init_many(response) ⇒ Object
nodoc.
-
.init_one(response) ⇒ Object
nodoc.
-
.xml_map ⇒ Object
nodoc.
Instance Method Summary collapse
- #all ⇒ Object
-
#custom_fields ⇒ Object
nodoc.
-
#party ⇒ Object
nodoc.
Methods inherited from Base
#==, #errors, find, #initialize, last_response, #new_record?
Constructor Details
This class inherits a constructor from CapsuleCRM::Base
Instance Attribute Details
#actual_close_date ⇒ Object
Returns the value of attribute actual_close_date.
10 11 12 |
# File 'lib/capsulecrm/opportunity.rb', line 10 def actual_close_date @actual_close_date end |
#created_on ⇒ Object
Returns the value of attribute created_on.
13 14 15 |
# File 'lib/capsulecrm/opportunity.rb', line 13 def created_on @created_on end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/capsulecrm/opportunity.rb', line 5 def currency @currency end |
#duration ⇒ Object
Returns the value of attribute duration.
8 9 10 |
# File 'lib/capsulecrm/opportunity.rb', line 8 def duration @duration end |
#duration_basis ⇒ Object
Returns the value of attribute duration_basis.
7 8 9 |
# File 'lib/capsulecrm/opportunity.rb', line 7 def duration_basis @duration_basis end |
#expected_close_date ⇒ Object
Returns the value of attribute expected_close_date.
9 10 11 |
# File 'lib/capsulecrm/opportunity.rb', line 9 def expected_close_date @expected_close_date end |
#milestone ⇒ Object
Returns the value of attribute milestone.
11 12 13 |
# File 'lib/capsulecrm/opportunity.rb', line 11 def milestone @milestone end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/capsulecrm/opportunity.rb', line 3 def name @name end |
#party_id ⇒ Object
Returns the value of attribute party_id.
4 5 6 |
# File 'lib/capsulecrm/opportunity.rb', line 4 def party_id @party_id end |
#probability ⇒ Object
Returns the value of attribute probability.
14 15 16 |
# File 'lib/capsulecrm/opportunity.rb', line 14 def probability @probability end |
#updated_on ⇒ Object
Returns the value of attribute updated_on.
12 13 14 |
# File 'lib/capsulecrm/opportunity.rb', line 12 def updated_on @updated_on end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/capsulecrm/opportunity.rb', line 6 def value @value end |
Class Method Details
.get_path ⇒ Object
nodoc
43 44 45 |
# File 'lib/capsulecrm/opportunity.rb', line 43 def self.get_path '/api/opportunity' end |
.init_many(response) ⇒ Object
nodoc
49 50 51 52 |
# File 'lib/capsulecrm/opportunity.rb', line 49 def self.init_many(response) data = response['opportunities']['opportunity'] CapsuleCRM::Collection.new(self, data) end |
.init_one(response) ⇒ Object
nodoc
55 56 57 58 |
# File 'lib/capsulecrm/opportunity.rb', line 55 def self.init_one(response) data = response['opportunity'] new(attributes_from_xml_hash(data)) end |
.xml_map ⇒ Object
nodoc
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/capsulecrm/opportunity.rb', line 17 def self.xml_map map = { 'name' => 'name', 'partyId' => 'party_id', 'currency' => 'currency', 'value' => 'value', 'durationBasis' => 'duration_basis', 'duration' => 'duration', 'expectedCloseDate' => 'expected_close_date', 'actualCloseDate' => 'actual_close_date', 'milestone' => 'milestone', 'updatedOn' => 'updated_on', 'createdOn' => 'created_on', 'probability' => 'probability', } super.merge map end |
Instance Method Details
#all ⇒ Object
35 36 37 38 39 40 |
# File 'lib/capsulecrm/opportunity.rb', line 35 def all return @opportunities if @opportunities path = self.class.get_path last_response = self.class.get(path) @opportunities = CapsuleCRM::Opportunity.init_many(last_response) end |
#custom_fields ⇒ Object
nodoc
67 68 69 70 71 72 73 74 |
# File 'lib/capsulecrm/opportunity.rb', line 67 def custom_fields return @custom_fields if @custom_fields path = self.class.get_path path = [path, '/', id, '/customfield'].join last_response = self.class.get(path) data = last_response['customFields'].try(:[], 'customField') @custom_fields = CapsuleCRM::CustomField.init_many(self, data) end |
#party ⇒ Object
nodoc
61 62 63 64 |
# File 'lib/capsulecrm/opportunity.rb', line 61 def party return nil if party_id.nil? @party ||= CapsuleCRM::Party.find(party_id) end |