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.



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

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.



13
14
15
# File 'lib/hubspot/deal_pipeline.rb', line 13

def active
  @active
end

#display_orderObject (readonly)

Returns the value of attribute display_order.



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

def display_order
  @display_order
end

#labelObject (readonly)

Returns the value of attribute label.



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

def label
  @label
end

#pipeline_idObject (readonly)

Returns the value of attribute pipeline_id.



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

def pipeline_id
  @pipeline_id
end

#stagesObject (readonly)

Returns the value of attribute stages.



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

def stages
  @stages
end

Class Method Details

.allObject



33
34
35
36
# File 'lib/hubspot/deal_pipeline.rb', line 33

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



41
42
43
44
# File 'lib/hubspot/deal_pipeline.rb', line 41

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

.find(pipeline_id) ⇒ Object



28
29
30
31
# File 'lib/hubspot/deal_pipeline.rb', line 28

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

Instance Method Details

#[](stage) ⇒ Object



54
55
56
# File 'lib/hubspot/deal_pipeline.rb', line 54

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

#destroy!TrueClass

Returns:

  • (TrueClass)

    true



50
51
52
# File 'lib/hubspot/deal_pipeline.rb', line 50

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