Module: Bnsly

Defined in:
lib/bnsly.rb,
lib/bnsly/version.rb

Constant Summary collapse

API_URL =
"http://bnsly.co"
VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.add(url, expires = false) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/bnsly.rb', line 10

def self.add(url, expires=false)
  url = URI.encode_www_form_component(url)
  if !expires
    response = Faraday.get("#{API_URL}/add/#{url}")
  else
    expires = expires.to_i
    response = Faraday.get("#{API_URL}/add/#{expires}/#{url}")
  end
  attributes = JSON.parse(response.body)
end

.lookup(guid) ⇒ Object



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

def self.lookup(guid)
  response = Faraday.get("#{API_URL}/lookup/#{guid}")
  attributes = JSON.parse(response.body)
end