Browse code

documentation and cleaning

Blackbeard authored on 2018-09-14 22:47:42
Showing 2 changed files
... ...
@@ -13,8 +13,6 @@
13 13
 
14 14
 # PARAMS documentation is on https://developer.jamendo.com/v3.0/read-methods
15 15
 
16
-
17
-
18 16
 #==============================
19 17
 #         BASIC URL          #
20 18
 #==============================
... ...
@@ -37,29 +35,40 @@ function _url_outputString {
37 35
 }
38 36
 
39 37
 #==============================
40
-#     PLAYLISTS URLS         #
38
+#      PLAYLISTS URLS        #
41 39
 #==============================
42 40
 
43
-# PARAMS -> URL
41
+# PARAMS_STRING -> URL
44 42
 # Outputs a url for playlists with parameters
45 43
 # this function won't check if type_url or params are valid
46
-#### todo
47 44
 function url_playlists {
48
-    echo ""
45
+    local type_url="playlists/"
46
+    local params="$1"
47
+    _url_outputString "$type_url" "$params"
49 48
 }
50 49
    
51
-# PARAMS -> URL
50
+# PARAMS_STRING -> URL
52 51
 # Outputs a url for playlist tracks with parameters
53 52
 # this function won't check if type_url or params are valid
54 53
 #### todo
55 54
 function url_playlistsTracks {
56
-    echo ""
55
+    local type_url="playlists/tracks/"
56
+    local params="$1"
57
+    _url_outputString "$type_url" "$params"
57 58
 }
58 59
 
60
+#### todo
61
+# PARAMS_STRING -> URL
62
+# Outputs a url for playlist tracks with parameters
63
+# this function won't check if type_url or params are valid
59 64
 
65
+function url_playlistsFile {
66
+    local type_url="playlists/file/"
67
+    local params="$1"
68
+    _url_outputString "$type_url" "$params"
69
+}
60 70
 
61 71
 
62
-#### write
63
-function url_playlists {
64
-    echo ""
65
-}
72
+#==============================
73
+#       ALBUMS  URLS        #
74
+#==============================
... ...
@@ -16,35 +16,32 @@ test_url_outputString() {
16 16
     assertEquals "$expected_string"  "$function_string"
17 17
 }
18 18
 
19
+#==============================
20
+#     PLAYLISTS URLS         #
21
+#==============================
19 22
 
20 23
 test_url_playlists() {
21
-    local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
22
-    
23
-    local function_string="$(_url_outputString "id=500423230&")"
24
+    local expected_string="https://api.jamendo.com/v3.0/playlists/?client_id=73efbf98&format=jsonpretty&user_id=6766768&limit=all"
25
+
26
+    local user_id="user_id=6766768"
27
+    local limit="limit=all"
28
+    local function_string="$(url_playlists "$user_id&$limit")"
24 29
 
25 30
     assertEquals "$expected_string"  "$function_string"
26 31
 }
27 32
 
28
-
29 33
 test_url_playlistsTracks() {
30
-    local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
31
-    
32
-    local function_string="$(_url_outputString "id=500423230&")"
33
-
34
-    assertEquals "$expected_string"  "$function_string"
34
+     local expected_string="https://api.jamendo.com/v3.0/playlists/tracks/?client_id=73efbf98&format=jsonpretty&id=500423230&"
35
+     local function_string="$(url_playlistsTracks "id=500423230&")"
36
+     assertEquals "$expected_string"  "$function_string"
35 37
 }
36 38
 
37 39
 
38 40
 
39
-
40
-
41
-
42 41
 oneTimeSetUp() {
43
-    # load my-jam.sh
44
-##    . ../lib/lib.sh 
42
+    # load proper libraries
45 43
     . ../../../lib/backend/jamendo/urls.sh 
46 44
 }
47 45
 
48
-
49 46
 . ../../../lib/shunit2 
50 47