29 lines
1002 B
Smalltalk
29 lines
1002 B
Smalltalk
"
|
|
Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:
|
|
|
|
For the Class part: State a one line summary. For example, ""I represent a paragraph of text"".
|
|
I represent a wrapper for the is.gd ethical shortener that doesn't track its users and is carbon neutral
|
|
(see https://is.gd/ethics.php for more details).
|
|
|
|
I use the public API as described in https://is.gd/apishorteningreference.php#restrict.
|
|
"
|
|
Class {
|
|
#name : #Shortener,
|
|
#superclass : #Object,
|
|
#category : #'Shortener-Model'
|
|
}
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
Shortener class >> enlarge: url [
|
|
"Given a shortened url in is.gd (or v.gd), I return the original url."
|
|
|
|
^ (ZnEasy get: 'https://is.gd/forward.php?format=simple&shorturl=', url) contents
|
|
]
|
|
|
|
{ #category : #'accessing structure variables' }
|
|
Shortener class >> shorten: url [
|
|
"I return the shortened url string as returned by https//is.gd ."
|
|
|
|
^ (ZnEasy get: 'https://is.gd/create.php?format=simple&url=', url) contents
|
|
]
|