Class: IndigogoFinder

Inherits:
BaseFinder show all
Defined in:
lib/indigogo_finder.rb

Instance Method Summary collapse

Methods inherited from BaseFinder

#reload, #set, #to_json

Methods included from AbstractInterface

included

Instance Method Details

#days_to_goObject



69
70
71
72
73
# File 'lib/indigogo_finder.rb', line 69

def days_to_go
  @json_obj['campaign_days_left']
rescue => e
    0
end

#deadlineObject

Override



63
64
65
66
67
# File 'lib/indigogo_finder.rb', line 63

def deadline
  @json_obj['campaign_end_date']
 rescue => e
    ""
end

#goalObject



49
50
51
52
53
# File 'lib/indigogo_finder.rb', line 49

def goal
    @json_obj['campaign_goal_amount']
  rescue => e
    ""
end

#init_gon_dataObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/indigogo_finder.rb', line 6

def init_gon_data
  source = @body.to_s
  start_index = source.index("gon.tealium_data_layer")
  short = source[start_index,source.length]
  end_index = short.index("gon.domain")
  json_data = short[0,end_index]

  i = (json_data.length-2)
  string = json_data[23..i]

  @json_obj = JSON.parse(string)
rescue => e
  ""
end

#num_of_backersObject



33
34
35
36
37
# File 'lib/indigogo_finder.rb', line 33

def num_of_backers
    @json_obj['campaign_funders']
  rescue => e
    ""
end

#picture_urlObject



55
56
57
58
59
# File 'lib/indigogo_finder.rb', line 55

def picture_url
    @json_obj['campaign_image_url']
  rescue => e
    ""
end

#pledgedObject



43
44
45
46
47
# File 'lib/indigogo_finder.rb', line 43

def pledged
    @json_obj['campaign_raised_amount']
  rescue => e
    ""
end

#precentageObject



75
76
77
78
79
# File 'lib/indigogo_finder.rb', line 75

def precentage
  (@json_obj['campaign_percent_of_goal'].to_f * 100).round
rescue => e
  0
end

#project_nameObject



27
28
29
30
31
# File 'lib/indigogo_finder.rb', line 27

def project_name
    @json_obj['campaign_name']
  rescue => e
    ""
end

#test_printObject



21
22
23
24
25
# File 'lib/indigogo_finder.rb', line 21

def test_print
    "I'm #{self.class.name} and my url is #{@url}"
  rescue => e
    ""
end


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

def twitter_link
  ""
end