Class: PipeRocket::Deal
Instance Attribute Summary collapse
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#person ⇒ Object
Returns the value of attribute person.
Class Method Summary collapse
-
.key_field_hash ⇒ Object
Returns hash PipeRocket::Field object.
Instance Method Summary collapse
-
#display_stage_name ⇒ Object
Returns stage name like PipelineName:StageName.
- #files ⇒ Object
-
#initialize(hash) ⇒ Deal
constructor
A new instance of Deal.
-
#stage ⇒ Object
Returns PipeRocket::Stage object corresponding to current deal stage.
Methods inherited from Entity
#assign_custom_fields, #transform_field_name
Constructor Details
#initialize(hash) ⇒ Deal
Returns a new instance of Deal.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pipe_rocket/deal.rb', line 13 def initialize(hash) super(hash.except(*Deal.key_field_hash.keys)) org_id = hash['org_id'] person_id = hash['person_id'] assign_custom_fields(Deal.key_field_hash, hash) if org_id @organization = case org_id when Integer Pipedrive.organizations.find(org_id) when Hash Organization.new(org_id) else nil end end if person_id @person = case person_id when Integer Pipedrive.persons.find(person_id) when Hash Person.new(person_id) else nil end end end |
Instance Attribute Details
#organization ⇒ Object
Returns the value of attribute organization.
6 7 8 |
# File 'lib/pipe_rocket/deal.rb', line 6 def organization @organization end |
#person ⇒ Object
Returns the value of attribute person.
6 7 8 |
# File 'lib/pipe_rocket/deal.rb', line 6 def person @person end |
Class Method Details
.key_field_hash ⇒ Object
Returns hash PipeRocket::Field object
9 10 11 |
# File 'lib/pipe_rocket/deal.rb', line 9 def self.key_field_hash @@key_field_hash ||= Pipedrive.deal_fields.key_field_hash end |
Instance Method Details
#display_stage_name ⇒ Object
Returns stage name like PipelineName:StageName
50 51 52 |
# File 'lib/pipe_rocket/deal.rb', line 50 def display_stage_name self.stage.display_name end |