Class: Fountain::Funnel

Inherits:
Object
  • Object
show all
Defined in:
lib/fountain/funnel.rb

Overview

Fountain Funnel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Funnel

Returns a new instance of Funnel.

Parameters:

  • data (Hash)

    Raw funnel data



14
15
16
# File 'lib/fountain/funnel.rb', line 14

def initialize(data)
  @raw_data = Util.stringify_hash_keys data
end

Instance Attribute Details

#raw_dataObject (readonly)

Raw funnel data



9
10
11
# File 'lib/fountain/funnel.rb', line 9

def raw_data
  @raw_data
end

Instance Method Details

#active?Boolean

Active

Returns:

  • (Boolean)


73
74
75
# File 'lib/fountain/funnel.rb', line 73

def active?
  raw_data['active']
end

#addressObject

Address



34
35
36
# File 'lib/fountain/funnel.rb', line 34

def address
  raw_data['address']
end

#custom_idObject

Custom ID



29
30
31
# File 'lib/fountain/funnel.rb', line 29

def custom_id
  raw_data['custom_id']
end

#descriptionObject

Description



44
45
46
# File 'lib/fountain/funnel.rb', line 44

def description
  raw_data['description']
end

#fieldsObject

Fields



54
55
56
57
58
# File 'lib/fountain/funnel.rb', line 54

def fields
  return [] unless raw_data['fields'].is_a? Array

  raw_data['fields'].map { |hash| Field.new hash }
end

#idObject

Funnel ID



19
20
21
# File 'lib/fountain/funnel.rb', line 19

def id
  raw_data['id']
end

#inspectObject



84
85
86
87
88
89
90
91
92
# File 'lib/fountain/funnel.rb', line 84

def inspect
  format(
    '#<%<class_name>s:0x%<object_id>p @id="%<id>s" @title="%<title>s">',
    class_name: self.class.name,
    object_id: object_id,
    id: id,
    title: title
  )
end

#locationObject

Location



78
79
80
81
82
# File 'lib/fountain/funnel.rb', line 78

def location
  return unless raw_data['location'].is_a? Hash

  Location.new raw_data['location']
end

#private?Boolean

Private

Returns:

  • (Boolean)


68
69
70
# File 'lib/fountain/funnel.rb', line 68

def private?
  raw_data['is_private']
end

#requirementsObject

Requirements



49
50
51
# File 'lib/fountain/funnel.rb', line 49

def requirements
  raw_data['requirements']
end

#stagesObject

Stages



61
62
63
64
65
# File 'lib/fountain/funnel.rb', line 61

def stages
  return [] unless raw_data['stages'].is_a? Array

  raw_data['stages'].map { |hash| Stage.new hash }
end

#time_zoneObject

Time zone



39
40
41
# File 'lib/fountain/funnel.rb', line 39

def time_zone
  raw_data['time_zone']
end

#titleObject

Title



24
25
26
# File 'lib/fountain/funnel.rb', line 24

def title
  raw_data['title']
end