Skip to content

Added option for extract existing url from history without create new one#7

Open
DanielePalombo wants to merge 2 commits intozigotto:masterfrom
DanielePalombo:master
Open

Added option for extract existing url from history without create new one#7
DanielePalombo wants to merge 2 commits intozigotto:masterfrom
DanielePalombo:master

Conversation

@DanielePalombo
Copy link

=== Shorten without generating new short URL (if exists long_url in history)
client = Googl.client('user@gmail.com', 'my_valid_password')
url = client.shorten('https://github.com/zigotto/googl')
url.short_url
=> http://goo.gl/DWDfi

url = client.shorten('https://github.com/zigotto/googl')
url.short_url
=> http://goo.gl/Oh48S

url = client.shorten('https://github.com/zigotto/googl', unique: true)
url.short_url
=> http://goo.gl/Oh48S

@johnnyshields
Copy link
Contributor

:unique is a misleading name for this option. I would think that if unique: true we should generate a new (unique) short URL for the input.

I would either do unique: false to use the existing, or call it something else like use_existing: true, reuse: true, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants