Class: Google::UrlShortner::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Création d’un nouveau client.



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

def initialize
  @short_url = @long_url = nil 
end

Instance Attribute Details

#long_urlObject (readonly)

Returns the value of attribute long_url.



32
33
34
# File 'lib/google_url_shortner.rb', line 32

def long_url
  @long_url
end

#short_urlObject (readonly)

Returns the value of attribute short_url.



32
33
34
# File 'lib/google_url_shortner.rb', line 32

def short_url
  @short_url
end

Instance Method Details

#expand(url) ⇒ Object

Retrouve ou retourne l’url d’un site donné à partir du “short_url”



42
43
44
# File 'lib/google_url_shortner.rb', line 42

def expand(url)
  Google::Expander.new(url)
end

#shorten(url) ⇒ Object

Crée la short url d’un site donné.



38
39
40
# File 'lib/google_url_shortner.rb', line 38

def shorten(url)
  Google::Shortner.new(url)
end