Skip to content

Commit

Permalink
refactor class side of spocstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
tanja04 committed Jul 8, 2024
1 parent 0c1aa2a commit 4b0dea8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/SpotifyConnect/SPOCApiAlbum.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ SPOCApiAlbum >> endpointMethod [

{
#category : #'api-call',
#'squeak_changestamp' : 'TL 7/7/2024 01:21'
#'squeak_changestamp' : 'TL 7/8/2024 17:20'
}
SPOCApiAlbum >> executeRequest: request withParams: aParameterDictionary [

request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle resultListLimit).
request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle defaultRequestLimit).
^ self client sendRequest: request
]

Expand Down
4 changes: 2 additions & 2 deletions src/SpotifyConnect/SPOCApiPlaylist.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ SPOCApiPlaylist >> endpointMethod [

{
#category : #'api-call',
#'squeak_changestamp' : 'TL 7/7/2024 01:20'
#'squeak_changestamp' : 'TL 7/8/2024 17:20'
}
SPOCApiPlaylist >> executeRequest: request withParams: aParameterDictionary [

request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle resultListLimit).
request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle defaultRequestLimit).
^ self client sendRequest: request
]

Expand Down
4 changes: 2 additions & 2 deletions src/SpotifyConnect/SPOCApiSearch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ SPOCApiSearch >> executeTest [

{
#category : #'api-call',
#'squeak_changestamp' : 'TL 7/7/2024 03:25'
#'squeak_changestamp' : 'TL 7/8/2024 17:20'
}
SPOCApiSearch >> search: aString withFilter: aFilter [

^ self execute: (Dictionary new at: #input put: aString;
at: #type put: aFilter;
at: #limit put: SPOCStyle resultListLimit;
at: #limit put: SPOCStyle defaultRequestLimit;
yourself)
]

Expand Down
17 changes: 13 additions & 4 deletions src/SpotifyConnect/SPOCResultListItem.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ SPOCResultListItem class >> newWith: aDataPiece [
yourself
]

{
#category : #constants,
#'squeak_changestamp' : 'TL 7/8/2024 17:18'
}
SPOCResultListItem class >> resultListItemHeight [

^ 96
]

{
#category : #accessing,
#'squeak_changestamp' : 'RK 6/7/2024 12:21'
Expand Down Expand Up @@ -78,12 +87,12 @@ SPOCResultListItem >> buildCenterBox [

{
#category : #building,
#'squeak_changestamp' : 'VE 7/8/2024 16:57'
#'squeak_changestamp' : 'TL 7/8/2024 17:17'
}
SPOCResultListItem >> buildImage [

| image |
image := self dataPiece image scaledTo: SPOCStyle resultListItemHeight - (2 * SPOCStyle defaultMargin).
image := self dataPiece image scaledTo: self class resultListItemHeight - (2 * SPOCStyle defaultMargin).
self image: image;
addMorph: image

Expand Down Expand Up @@ -147,12 +156,12 @@ SPOCResultListItem >> centerBox [

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'RK 7/7/2024 12:55'
#'squeak_changestamp' : 'TL 7/8/2024 17:17'
}
SPOCResultListItem >> changeItemTo: aDataPiece [

| form |
form := (aDataPiece image scaledTo: SPOCStyle resultListItemHeight - (2 * SPOCStyle defaultMargin)) form.
form := (aDataPiece image scaledTo: self class resultListItemHeight - (2 * SPOCStyle defaultMargin)) form.
self image image: form.
self primaryText contents: (aDataPiece primaryText asText addAttribute: TextEmphasis bold).
self secondaryText contents: (aDataPiece secondaryText).
Expand Down
37 changes: 5 additions & 32 deletions src/SpotifyConnect/SPOCStyle.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,20 @@ SPOCStyle class >> defaultMargin [

{
#category : #constants,
#'squeak_changestamp' : 'RK 6/8/2024 23:35'
}
SPOCStyle class >> gitRepoName [

^ 'SpotifyConnect'
]

{
#category : #constants,
#'squeak_changestamp' : 'RK 6/7/2024 11:10'
}
SPOCStyle class >> resultListItemHeight [

^ 96
]

{
#category : #constants,
#'squeak_changestamp' : 'RK 6/7/2024 11:10'
#'squeak_changestamp' : 'TL 7/8/2024 17:20'
}
SPOCStyle class >> resultListItemPadding [

^ 95
]

{
#category : #constants,
#'squeak_changestamp' : 'VE 6/10/2024 14:20'
}
SPOCStyle class >> resultListLimit [
SPOCStyle class >> defaultRequestLimit [

^ 10
]

{
#category : #constants,
#'squeak_changestamp' : 'VE 6/10/2024 14:45'
#'squeak_changestamp' : 'RK 6/8/2024 23:35'
}
SPOCStyle class >> resultListWidth [
SPOCStyle class >> gitRepoName [

^ 1048
^ 'SpotifyConnect'
]

{
Expand Down
4 changes: 2 additions & 2 deletions src/SpotifyConnect/SPOCTestApiSearch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ SPOCTestApiSearch >> setUp [

{
#category : #testing,
#'squeak_changestamp' : 'TL 6/24/2024 03:27'
#'squeak_changestamp' : 'TL 7/8/2024 17:20'
}
SPOCTestApiSearch >> testApiSearchExecute [

| dict res |
dict := Dictionary new
at: #input put: 'Morning+Blue';
at: #type put: 'track';
at: #limit put: SPOCStyle resultListLimit;
at: #limit put: SPOCStyle defaultRequestLimit;
yourself.
res := self apiEndpoint execute: dict.
self assert: res class ~= SPOCApiEndpointResult
Expand Down

0 comments on commit 4b0dea8

Please sign in to comment.