InstagramPharo/Instagram/InstagramUrl.class.st

69 lines
1.1 KiB
Smalltalk

"
I manage instagram URLs information.
InstagramUrl newURL: 'https://instagram.com/restOfURL'
"
Class {
#name : 'InstagramUrl',
#superclass : 'Object',
#instVars : [
'url',
'type'
],
#category : 'Instagram',
#package : 'Instagram'
}
{ #category : 'instance creation' }
InstagramUrl class >> newURL: url [
| instance |
instance := self new.
instance url: (instance urlCheck: url).
^ instance
]
{ #category : 'initialization' }
InstagramUrl >> initialize [
super initialize.
self url.
self type.
]
{ #category : 'opening' }
InstagramUrl >> openWithoutTracking [
WebBrowser openOn: self urlWithoutTracking
]
{ #category : 'accessing' }
InstagramUrl >> type [
^ type
]
{ #category : 'accessing' }
InstagramUrl >> url [
^ url ifNil: [ url := 'https://instagram.com/' asUrl ]
]
{ #category : 'accessing' }
InstagramUrl >> url: aURL [
url := aURL
]
{ #category : 'accessing - data' }
InstagramUrl >> urlTypes [
"I have the collection of correct types."
^ { 'root' . 'user' }
]
{ #category : 'accessing' }
InstagramUrl >> urlWithoutTracking [
^ self url queryRemoveAll; asStringOrText
]