class IndigogoFinder

Public Instance Methods

days_to_go() click to toggle source
# File lib/indigogo_finder.rb, line 69
def days_to_go
  @json_obj['campaign_days_left']
rescue => e
    0
end
deadline() click to toggle source

Override

# File lib/indigogo_finder.rb, line 63
def deadline
  @json_obj['campaign_end_date']
 rescue => e
    ""
end
goal() click to toggle source
# File lib/indigogo_finder.rb, line 49
def goal
    @json_obj['campaign_goal_amount']
  rescue => e
    ""
end
init_gon_data() click to toggle source
# 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_backers() click to toggle source
# File lib/indigogo_finder.rb, line 33
def num_of_backers
    @json_obj['campaign_funders']
  rescue => e
    ""
end
picture_url() click to toggle source
# File lib/indigogo_finder.rb, line 55
def picture_url
    @json_obj['campaign_image_url']
  rescue => e
    ""
end
pledged() click to toggle source
# File lib/indigogo_finder.rb, line 43
def pledged
    @json_obj['campaign_raised_amount']
  rescue => e
    ""
end
precentage() click to toggle source
# File lib/indigogo_finder.rb, line 75
def precentage
  (@json_obj['campaign_percent_of_goal'].to_f * 100).round
rescue => e
  0
end
project_name() click to toggle source
# File lib/indigogo_finder.rb, line 27
def project_name
    @json_obj['campaign_name']
  rescue => e
    ""
end
test_print() click to toggle source
# File lib/indigogo_finder.rb, line 21
def test_print
    "I'm #{self.class.name} and my url is #{@url}"
  rescue => e
    ""
end