Class: Hubspot::DealPipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/deal_pipeline.rb

Overview

Constant Summary collapse

PIPELINES_PATH =
"/deals/v1/pipelines"
PIPELINE_PATH =
"/deals/v1/pipelines/:pipeline_id"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ DealPipeline

Returns a new instance of DealPipeline.



21
22
23
24
25
26
27
# File 'lib/hubspot/deal_pipeline.rb', line 21

def initialize(response_hash)
  @active = response_hash["active"]
  @display_order = response_hash["displayOrder"]
  @label = response_hash["label"]
  @pipeline_id = response_hash["pipelineId"]
  @stages = response_hash["stages"]
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



15
16
17
# File 'lib/hubspot/deal_pipeline.rb', line 15

def active
  @active
end

#display_orderObject (readonly)

Returns the value of attribute display_order.



16
17
18
# File 'lib/hubspot/deal_pipeline.rb', line 16

def display_order
  @display_order
end

#labelObject (readonly)

Returns the value of attribute label.



17
18
19
# File 'lib/hubspot/deal_pipeline.rb', line 17

def label
  @label
end

#pipeline_idObject (readonly)

Returns the value of attribute pipeline_id.



18
19
20
# File 'lib/hubspot/deal_pipeline.rb', line 18

def pipeline_id
  @pipeline_id
end

#stagesObject (readonly)

Returns the value of attribute stages.



19
20
21
# File 'lib/hubspot/deal_pipeline.rb', line 19

def stages
  @stages
end

Class Method Details

.allObject



35
36
37
38
# File 'lib/hubspot/deal_pipeline.rb', line 35

def all
  response = Hubspot::Connection.get_json(PIPELINES_PATH, {})
  response.map { |p| new(p) }
end

.create!(post_data = {}) ⇒ Hubspot::PipeLine

Returns:

  • (Hubspot::PipeLine)

    Company record



43
44
45
46
# File 'lib/hubspot/deal_pipeline.rb', line 43

def create!(post_data={})
  response = Hubspot::Connection.post_json(PIPELINES_PATH, params: {}, body: post_data)
  new(response)
end

.find(pipeline_id) ⇒ Object



30
31
32
33
# File 'lib/hubspot/deal_pipeline.rb', line 30

def find(pipeline_id)
  response = Hubspot::Connection.get_json(PIPELINE_PATH, { pipeline_id: pipeline_id })
  new(response)
end

Instance Method Details

#[](stage) ⇒ Object



56
57
58
# File 'lib/hubspot/deal_pipeline.rb', line 56

def [](stage)
  @stages[stage]
end

#destroy!TrueClass

Returns:

  • (TrueClass)

    true



52
53
54
# File 'lib/hubspot/deal_pipeline.rb', line 52

def destroy!
  Hubspot::Connection.delete_json(PIPELINE_PATH, pipeline_id: @pipeline_id)
end