Class: Fountain::Api::Funnels

Inherits:
Object
  • Object
show all
Extended by:
RequestHelper
Defined in:
lib/fountain/api/funnels.rb

Overview

Fountain Funnel Management API

Constant Summary

Constants included from RequestHelper

RequestHelper::DEFAULT_REQUEST_OPTIONS

Class Method Summary collapse

Methods included from RequestHelper

request, request_json

Class Method Details

.get(funnel_id) ⇒ Fountain::Funnel

Get Funnel Info

Parameters:

  • funnel_id (String)

    ID of the Fountain funnel

Returns:



25
26
27
28
# File 'lib/fountain/api/funnels.rb', line 25

def self.get(funnel_id)
  response = request_json("/v2/funnels/#{funnel_id}")
  Fountain::Funnel.new response
end

.list(list_options = {}) ⇒ Fountain::Funnels

List all Funnels

Parameters:

  • list_options (Hash) (defaults to: {})

    A hash of options when listing funnels

Returns:



15
16
17
18
19
# File 'lib/fountain/api/funnels.rb', line 15

def self.list(list_options = {})
  page_query = list_options[:page] ? "?page=#{list_options[:page]}" : ''
  response = request_json("/v2/funnels#{page_query}")
  Fountain::Funnels.new response
end

.list_stages(funnel_id) ⇒ [Fountain::Stage]

List all Funnel stages

Parameters:

  • funnel_id (String)

    ID of the Fountain funnel

Returns:



49
50
51
52
# File 'lib/fountain/api/funnels.rb', line 49

def self.list_stages(funnel_id)
  response = request_json("/v2/funnels/#{funnel_id}/stages")
  response['stages'].map { |hash| Fountain::Stage.new hash }
end

.update(funnel_id, update_options = {}) ⇒ Fountain::Funnel

Update Funnel

Parameters:

  • funnel_id (String)

    ID of the Fountain funnel

  • update_options (Hash) (defaults to: {})

    A hash of options when updating a funnel custom_id

Returns:



36
37
38
39
40
41
42
43
# File 'lib/fountain/api/funnels.rb', line 36

def self.update(funnel_id, update_options = {})
  response = request_json(
    "/v2/funnels/#{funnel_id}",
    method: :put,
    body: Util.slice_hash(update_options, :custom_id)
  )
  Fountain::Funnel.new response
end