siilar 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ca39c15768d357e7f84fcb1bcccf2e3c4ca806c
4
- data.tar.gz: 6ace98f69649c6f64582204454f26b6b055646f1
3
+ metadata.gz: 0b17083450469418ae3c14ddb410f8fb30a15241
4
+ data.tar.gz: ef87152d3243cb1991e2ab91a418c9d695b0352c
5
5
  SHA512:
6
- metadata.gz: 5fd797ad4a8ff0626f7ad4a37fefb71aff08dbd9bab941c41b4f64a473407a21070e9fe0182dcce0d1e0958128d798ba94d025d83af4e370741a4eea7b58ad8a
7
- data.tar.gz: f98c8b75e8850c8f6005a8d1c9d5efecc05c7e83d55d4897658caf6459fa44c51133e64d19bbe1e97f68b8d3ec550fa5b161c7df28ae2f98ad40e4a4758301fc
6
+ metadata.gz: fb9aeba2546609d274c0a58d5b763a5eb44c28f9205956a78da75c2130af4b4c1db6d11e97f4c41ef9a37245b4dda3ebb39504c19cfac334194f5438cac71f90
7
+ data.tar.gz: 3c6b546f65b3d7795ca7214ca8128d9b699df0d1cbd16143b4af21ed4fa92accf07aa9fc2259d5934f20dd4ad538b88004d85a94664cb294caa0fdc9da00c376
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Siilar Ruby Client [![Build Status](https://travis-ci.org/craftsmen/niland-siilar-ruby.svg?branch=better-methods-names)](https://travis-ci.org/craftsmen/niland-siilar-ruby)
2
2
 
3
- A Ruby client for the [Siilar API](http://api.niland.io/1.0/doc/).
3
+ A Ruby client for the [Siilar API](http://api.niland.io/2.0/doc/).
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- This library is a Ruby client you can use to interact with the [Siilar API](http://api.niland.io/1.0/doc/).
21
+ This library is a Ruby client you can use to interact with the [Siilar API](http://api.niland.io/2.0/doc/).
22
22
 
23
23
  Here's a short example.
24
24
 
@@ -28,7 +28,7 @@ require 'siilar'
28
28
  client = Siilar::Client.new(api_key: 'YOUR_KEY')
29
29
 
30
30
  # Create a track
31
- track = client.tracks.create(title: 'Nine Lives', external_id: '123')
31
+ track = client.tracks.create(title: 'Nine Lives', reference: '123')
32
32
  puts "Track: %s (id: %d)" % [track.title, track.id]
33
33
 
34
34
  # Search for similar tracks
@@ -4,77 +4,102 @@ module Siilar
4
4
 
5
5
  # Get a list of your radios.
6
6
  #
7
- # @see http://api.niland.io/1.0/doc/radios#list-radios
7
+ # @see http://api.niland.io/2.0/doc/radios#list-radios
8
8
  def list
9
- response = client.get('1.0/radios')
10
- response.map { |radio| Struct::Radio.new(radio) }
9
+ response = client.get('2.0/radios')
10
+ response['data'].map { |radio| Struct::Radio.new(radio) }
11
11
  end
12
12
 
13
13
  # Get a radio.
14
14
  #
15
- # @see http://api.niland.io/1.0/doc/radios#get-a-radio
15
+ # @see http://api.niland.io/2.0/doc/radios#get-a-radio
16
16
  def get(radio)
17
- response = client.get("1.0/radios/#{radio}")
17
+ response = client.get("2.0/radios/#{radio}")
18
18
  Struct::Radio.new(response)
19
19
  end
20
20
 
21
21
  # Create a radio.
22
22
  #
23
- # @see http://api.niland.io/1.0/doc/radios#create-a-radio
23
+ # @see http://api.niland.io/2.0/doc/radios#create-a-radio
24
24
  def create(attributes = {})
25
- response = client.post('1.0/radios', attributes)
25
+ response = client.post('2.0/radios', attributes)
26
26
  Struct::Radio.new(response)
27
27
  end
28
28
 
29
29
  # Edit a radio.
30
30
  #
31
- # @see http://api.niland.io/1.0/doc/radios#edit-a-radio
31
+ # @see http://api.niland.io/2.0/doc/radios#edit-a-radio
32
32
  def edit(radio, attributes = {})
33
- response = client.patch("1.0/radios/#{radio}", attributes)
33
+ response = client.patch("2.0/radios/#{radio}", attributes)
34
34
  Struct::Radio.new(response)
35
35
  end
36
36
 
37
+ # Delete a radio.
38
+ #
39
+ # @see http://api.niland.io/2.0/doc/radios#delete-a-radio
40
+ def delete(radio, attributes = {})
41
+ response = client.delete("2.0/radios/#{radio}")
42
+ end
43
+
37
44
  # Get next radio tracks
38
45
  #
39
- # @see http://api.niland.io/1.0/doc/radios#get-next-radio-tracks
46
+ # @see http://api.niland.io/2.0/doc/radios#get-next-radio-tracks
40
47
  def get_next(radio)
41
- response = client.get("1.0/radios/#{radio}/next")
48
+ response = client.get("2.0/radios/#{radio}/next")
42
49
  response.map { |track| Struct::Track.new(track) }
43
50
  end
44
51
 
45
52
  # Notify a skip.
46
53
  #
47
- # @see http://api.niland.io/1.0/doc/radios#notify-a-skip
54
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-skip
48
55
  def notify_skip(radio, attributes = {})
49
56
  Extra.validate_mandatory_attributes(attributes, [:track])
50
- response = client.post("1.0/radios/#{radio}/skips", attributes)
57
+ response = client.post("2.0/radios/#{radio}/skips", attributes)
51
58
  Struct::Radio.new(response)
52
59
  end
53
60
 
54
61
  # Notify a like.
55
62
  #
56
- # @see http://api.niland.io/1.0/doc/radios#notify-a-like
63
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-like
57
64
  def notify_like(radio, attributes = {})
58
65
  Extra.validate_mandatory_attributes(attributes, [:track])
59
- response = client.post("1.0/radios/#{radio}/likes", attributes)
66
+ response = client.post("2.0/radios/#{radio}/likes", attributes)
60
67
  Struct::Radio.new(response)
61
68
  end
62
69
 
63
70
  # Notify a dislike.
64
71
  #
65
- # @see http://api.niland.io/1.0/doc/radios#notify-a-dislike
72
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-dislike
66
73
  def notify_dislike(radio, attributes = {})
67
74
  Extra.validate_mandatory_attributes(attributes, [:track])
68
- response = client.post("1.0/radios/#{radio}/dislikes", attributes)
75
+ response = client.post("2.0/radios/#{radio}/dislikes", attributes)
76
+ Struct::Radio.new(response)
77
+ end
78
+
79
+ # Notify a ban.
80
+ #
81
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-ban
82
+ def notify_ban(radio, attributes = {})
83
+ Extra.validate_mandatory_attributes(attributes, [:track])
84
+ response = client.post("2.0/radios/#{radio}/bans", attributes)
69
85
  Struct::Radio.new(response)
70
86
  end
71
87
 
72
88
  # Notify a favorite.
73
89
  #
74
- # @see http://api.niland.io/1.0/doc/radios#notify-a-favorite
90
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-favorite
75
91
  def notify_favorite(radio, attributes = {})
76
92
  Extra.validate_mandatory_attributes(attributes, [:track])
77
- response = client.post("1.0/radios/#{radio}/favorites", attributes)
93
+ response = client.post("2.0/radios/#{radio}/favorites", attributes)
94
+ Struct::Radio.new(response)
95
+ end
96
+
97
+ # Notify a not played track.
98
+ #
99
+ # @see http://api.niland.io/2.0/doc/radios#notify-a-not-played-track
100
+ def notify_not_played(radio, attributes = {})
101
+ Extra.validate_mandatory_attributes(attributes, [:track])
102
+ response = client.post("2.0/radios/#{radio}/notplayed", attributes)
78
103
  Struct::Radio.new(response)
79
104
  end
80
105
  end
@@ -4,32 +4,22 @@ module Siilar
4
4
 
5
5
  # Search for a track
6
6
  #
7
- # @see http://api.niland.io/1.0/doc/search-and-analyze#search
8
- def similar(query = {})
7
+ # @see https://api.niland.io/2.0/doc/tracks#search-for-tracks
8
+ def tracks(query = {})
9
9
  options = { query: query }
10
- response = client.get('1.0/search', options)
10
+ response = client.get('2.0/tracks/search', options)
11
11
 
12
- response.map { |r| Struct::Track.new(r) }
12
+ response['data'].map { |r| Struct::Track.new(r) }
13
13
  end
14
14
 
15
15
  # Search for a track from external ids
16
16
  #
17
- # @see http://api.niland.io/1.0/doc/search-and-analyze#search-from-external
18
- def similar_from_external(query = {})
17
+ # @see http://api.niland.io/2.0/doc/search-and-analyze#search-from-external
18
+ def suggestions(query = {})
19
19
  options = { query: query }
20
- response = client.get('1.0/search-from-external', options)
20
+ response = client.get('2.0/suggestions', options)
21
21
 
22
- response.map { |r| Struct::Track.new(r) }
23
- end
24
-
25
- # Search for similar tracks from query
26
- #
27
- # @see https://api.niland.io/1.0/doc/search-and-analyze#search-from-any
28
- def similar_from_any(query = {})
29
- options = { query: query }
30
- response = client.get('1.0/search-from-any', options)
31
-
32
- response.map { |r| Struct::Track.new(r) }
22
+ Struct::Suggestion.new(response)
33
23
  end
34
24
  end
35
25
  end
@@ -2,58 +2,96 @@ module Siilar
2
2
  class Client
3
3
  module Tags
4
4
 
5
- # Get all the tag collections
5
+ # list or find tag collections
6
6
  #
7
- # @see http://api.niland.io/1.0/doc/tags#list-tag-collections
8
- def tag_collections
9
- response = client.get('1.0/tag-collections')
7
+ # @see http://api.niland.io/2.0/doc/tags#list-or-find-tag-collections
8
+ def tag_collections(query = {})
9
+ options = { query: query }
10
+ response = client.get('2.0/tag-collections', options)
10
11
 
11
- response.map { |r| Struct::TagCollection.new(r) }
12
+ response['data'].map { |r| Struct::TagCollection.new(r) }
12
13
  end
13
14
 
14
15
  # Get one tag collection
15
16
  #
16
- # @see http://api.niland.io/1.0/doc/tags#get-tag-collections
17
+ # @see http://api.niland.io/2.0/doc/tags#get-a-tag-collection
17
18
  def tag_collection(collection)
18
- response = client.get("1.0/tag-collections/#{collection}")
19
+ response = client.get("2.0/tag-collections/#{collection}")
19
20
 
20
21
  Struct::TagCollection.new(response)
21
22
  end
22
23
 
23
24
  # Create a tag collection
24
25
  #
25
- # @see http://api.niland.io/1.0/doc/tags#create-tag-collections
26
+ # @see http://api.niland.io/2.0/doc/tags#create-a-tag-collection
26
27
  def create_tag_collection(attributes = {})
27
28
  Extra.validate_mandatory_attributes(attributes, [:name])
28
- response = client.post('1.0/tag-collections', attributes)
29
+ response = client.post('2.0/tag-collections', attributes)
29
30
 
30
31
  Struct::TagCollection.new(response)
31
32
  end
32
33
 
33
34
  # Edit a tag collection
34
35
  #
35
- # @see http://api.niland.io/1.0/doc/tags#edit-tag-collections
36
+ # @see http://api.niland.io/2.0/doc/tags#edit-a-tag-collection
36
37
  def edit_tag_collection(collection, attributes = {})
37
- response = client.patch("1.0/tag-collections/#{collection}", attributes)
38
+ response = client.patch("2.0/tag-collections/#{collection}", attributes)
38
39
 
39
40
  Struct::TagCollection.new(response)
40
41
  end
41
42
 
42
43
  # Delete a tag collection
43
44
  #
44
- # @see http://api.niland.io/1.0/doc/tags#delete-tag-collections
45
+ # @see http://api.niland.io/2.0/doc/tags#delete-a-tag-collection
45
46
  def delete_tag_collection(collection)
46
- client.delete("1.0/tag-collections/#{collection}")
47
+ client.delete("2.0/tag-collections/#{collection}")
47
48
  end
48
49
 
49
- # Find tags
50
+ # list or find tags
50
51
  #
51
- # @see http://api.niland.io/1.0/doc/tags#find-tags
52
- def find_tags(attributes = {})
53
- response = client.get('1.0/tags', attributes)
52
+ # @see http://api.niland.io/2.0/doc/tags#list-or-find-tags
53
+ def find_tags(query = {})
54
+ options = { query: query }
55
+ response = client.get('2.0/tags', options)
56
+
57
+ response['data'].map { |tag| Struct::Tag.new(tag) }
58
+ end
59
+
60
+ # Get one tag
61
+ #
62
+ # @see http://api.niland.io/2.0/doc/tags#get-a-tag
63
+ def tag(tag)
64
+ response = client.get("2.0/tags/#{tag}")
65
+
66
+ Struct::Tag.new(response)
67
+ end
68
+
69
+ # Create a tag
70
+ #
71
+ # @see http://api.niland.io/2.0/doc/tags#create-a-tag
72
+ def create_tag(attributes = {})
73
+ Extra.validate_mandatory_attributes(attributes, [:title, :tag_collection])
74
+ response = client.post('2.0/tags', attributes)
54
75
 
55
76
  Struct::Tag.new(response)
56
77
  end
78
+
79
+ # Edit a tag
80
+ #
81
+ # @see http://api.niland.io/2.0/doc/tags#edit-a-tag
82
+ def edit_tag(tag, attributes = {})
83
+ response = client.patch("2.0/tags/#{tag}", attributes)
84
+
85
+ Struct::Tag.new(response)
86
+ end
87
+
88
+ # Delete a tag
89
+ #
90
+ # @see http://api.niland.io/2.0/doc/tags#delete-a-tag
91
+ def delete_tag(tag)
92
+ client.delete("2.0/tags/#{tag}")
93
+ end
94
+
57
95
  end
58
96
  end
59
97
  end
@@ -2,57 +2,97 @@ module Siilar
2
2
  class Client
3
3
  module Tracks
4
4
 
5
- # Gets a track.
5
+ # List tracks.
6
6
  #
7
- # @see http://api.niland.io/1.0/doc/tracks#get-a-track
8
- def track(track)
9
- response = client.get("1.0/tracks/#{track}")
7
+ # @see http://api.niland.io/2.0/doc/tracks#list-tracks
8
+ def tracks(query = {})
9
+ options = { query: query }
10
+ response = client.get("2.0/tracks", options)
10
11
 
11
- Struct::Track.new(response)
12
+ response['data'].map { |track| Struct::Track.new(track) }
12
13
  end
13
14
 
14
- # Gets an external track.
15
+ # Gets a track.
15
16
  #
16
- # @see https://api.niland.io/doc/tracks#get-an-external-track
17
- def external_track(track)
18
- response = client.get("1.0/external-tracks/#{track}")
17
+ # @see http://api.niland.io/2.0/doc/tracks#get-a-track
18
+ def track(track)
19
+ response = client.get("2.0/tracks/#{track}")
19
20
 
20
- Struct::ExternalTrack.new(response)
21
+ Struct::Track.new(response)
21
22
  end
22
23
 
23
- # Gets a track from its external id.
24
+ # Gets a track from its internal reference.
24
25
  #
25
- # @see https://api.niland.io/doc/tracks#get-tracks-from-external
26
- def from_external(track)
27
- response = client.get("1.0/from-external/#{track}")
26
+ # @see https://api.niland.io/doc/tracks#get-a-track-from-your-internal-reference
27
+ def from_reference(reference)
28
+ response = client.get("2.0/tracks/reference/#{reference}")
28
29
 
29
- response.map { |r| Struct::Track.new(r) }
30
+ Struct::Track.new(response)
30
31
  end
31
32
 
32
33
  # Creates a track.
33
34
  #
34
- # @see http://api.niland.io/1.0/doc/tracks#create-a-track
35
+ # @see http://api.niland.io/2.0/doc/tracks#create-a-track
35
36
  def create(attributes = {})
36
- Extra.validate_mandatory_attributes(attributes, [:title, :external_id])
37
- response = client.post('1.0/tracks', attributes)
37
+ Extra.validate_mandatory_attributes(attributes, [:title, :reference])
38
+ response = client.post('2.0/tracks', attributes)
38
39
 
39
40
  Struct::Track.new(response)
40
41
  end
41
42
 
43
+ # Upload a temporary track.
44
+ #
45
+ # @see https://api.niland.io/2.0/doc/tracks#upload-a-temporary-track
46
+ # def upload_temporary(attributes = {})
47
+ # options = {
48
+ # headers: {
49
+ # 'Content-Type' => 'multipart/form-data'
50
+ # }
51
+ # }
52
+ # Extra.validate_mandatory_attributes(attributes, [:file])
53
+ # response = client.execute(:post, '2.0/tracks/temporaries', attributes, options)
54
+
55
+ # Struct::TemporaryTrack.new(response)
56
+ # end
57
+
42
58
  # Updates a track.
43
59
  #
44
- # @see http://api.niland.io/1.0/doc/tracks#edit-a-track
60
+ # @see http://api.niland.io/2.0/doc/tracks#edit-a-track
45
61
  def update(track, attributes = {})
46
- response = client.patch("1.0/tracks/#{track}", attributes)
62
+ response = client.patch("2.0/tracks/#{track}", attributes)
47
63
 
48
64
  Struct::Track.new(response)
49
65
  end
50
66
 
67
+ # Updates a track audio file
68
+ #
69
+ # @see https://api.niland.io/2.0/doc/tracks#upload-a-temporary-track
70
+ # def edit_audio_file(track, attributes = {})
71
+ # options = {
72
+ # headers: {
73
+ # 'Content-Type' => 'multipart/form-data'
74
+ # }
75
+ # }
76
+ # response = client.execute(:post, "2.0/tracks/#{track}/audio", attributes, options)
77
+
78
+ # Struct::Track.new(response)
79
+ # end
80
+
51
81
  # Deletes a track.
52
82
  #
53
- # @see http://api.niland.io/1.0/doc/tracks#delete-a-track
83
+ # @see http://api.niland.io/2.0/doc/tracks#delete-a-track
54
84
  def delete(track)
55
- client.delete("1.0/tracks/#{track}")
85
+ client.delete("2.0/tracks/#{track}")
86
+ end
87
+
88
+
89
+ # Gets a track's tags.
90
+ #
91
+ # @see https://api.niland.io/2.0/doc/tracks#get-track-tags
92
+ def tags(track)
93
+ response = client.get("2.0/tracks/#{track}/tags")
94
+
95
+ response.map { |tag| Struct::Tag.new(tag) }
56
96
  end
57
97
  end
58
98
  end
@@ -4,84 +4,76 @@ module Siilar
4
4
 
5
5
  # Get a list of your users.
6
6
  #
7
- # @see http://api.niland.io/1.0/doc/users#list-users
7
+ # @see http://api.niland.io/2.0/doc/users#list-users
8
8
  def list(query = {})
9
- response = client.get('1.0/users')
10
- response.map { |user| Struct::User.new(user) }
9
+ response = client.get('2.0/users')
10
+ response['data'].map { |user| Struct::User.new(user) }
11
11
  end
12
12
 
13
13
  # Get a user.
14
14
  #
15
- # @see http://api.niland.io/1.0/doc/users#get-a-user
15
+ # @see http://api.niland.io/2.0/doc/users#get-a-user
16
16
  def get(user)
17
- response = client.get("1.0/users/#{user}")
17
+ response = client.get("2.0/users/#{user}")
18
18
  Struct::User.new(response)
19
19
  end
20
20
 
21
21
  # Create a user.
22
22
  #
23
- # @see http://api.niland.io/1.0/doc/users#create-a-user
23
+ # @see http://api.niland.io/2.0/doc/users#create-a-user
24
24
  def create(attributes = {})
25
- Extra.validate_mandatory_attributes(attributes, [:external_id])
26
- response = client.post('1.0/users', attributes)
25
+ Extra.validate_mandatory_attributes(attributes, [:reference])
26
+ response = client.post('2.0/users', attributes)
27
27
  Struct::User.new(response)
28
28
  end
29
29
 
30
30
  # Update a user.
31
31
  #
32
- # @see http://api.niland.io/1.0/doc/users#update-a-user
32
+ # @see http://api.niland.io/2.0/doc/users#edit-a-user
33
33
  def update(user, attributes = {})
34
- response = client.patch("1.0/users/#{user}", attributes)
34
+ response = client.patch("2.0/users/#{user}", attributes)
35
35
  Struct::User.new(response)
36
36
  end
37
37
 
38
38
  # Delete a user.
39
39
  #
40
- # @see http://api.niland.io/1.0/doc/users#delete-a-user
40
+ # @see http://api.niland.io/2.0/doc/users#delete-a-user
41
41
  def delete(user)
42
- client.delete("1.0/users/#{user}")
42
+ client.delete("2.0/users/#{user}")
43
43
  end
44
44
 
45
- # Get next user tracks
45
+ # Get user likes
46
46
  #
47
- # @see http://api.niland.io/1.0/doc/users#get-next-user-tracks
48
- def get_next(user)
49
- response = client.get("1.0/users/#{user}/next")
50
- response.map { |user| Struct::User.new(response) }
47
+ # @see http://api.niland.io/2.0/doc/users#get-user-likes
48
+ def get_likes(user)
49
+ response = client.get("2.0/users/#{user}/likes")
50
+ response['data'].map { |track| Struct::Track.new(track) }
51
51
  end
52
52
 
53
- # Get liked tracks.
53
+ # Add a user like.
54
54
  #
55
- # @see https://api.niland.io/doc/users#get-liked-tracks
56
- def get_liked_tracks(user)
57
- response = client.get("1.0/users/#{user}/likes")
58
- response.map { |track| Struct::Track.new(track) }
59
- end
60
-
61
- # Add liked tracks.
62
- #
63
- # @see https://api.niland.io/doc/users#add-liked-track
64
- def add_liked_track(user, attributes = {})
55
+ # @see https://api.niland.io/doc/users#add-a-user-like
56
+ def add_like(user, attributes = {})
65
57
  Extra.validate_mandatory_attributes(attributes, [:track])
66
- response = client.post("1.0/users/#{user}/likes", attributes)
67
- Struct::Track.new(response)
58
+ response = client.post("2.0/users/#{user}/likes", attributes)
59
+ Struct::Track.new(response['track'])
68
60
  end
69
61
 
70
- # Get disliked tracks.
62
+ # Get user dislikes
71
63
  #
72
- # @see https://api.niland.io/doc/users#get-disliked-tracks
73
- def get_disliked_tracks(user)
74
- response = client.get("1.0/users/#{user}/dislikes")
75
- response.map { |track| Struct::Track.new(track) }
64
+ # @see http://api.niland.io/2.0/doc/users#get-user-dislikes
65
+ def get_dislikes(user)
66
+ response = client.get("2.0/users/#{user}/dislikes")
67
+ response['data'].map { |track| Struct::Track.new(track) }
76
68
  end
77
69
 
78
- # Add disliked tracks.
70
+ # Add a user dislike.
79
71
  #
80
- # @see https://api.niland.io/doc/users#add-disliked-track
81
- def add_disliked_track(user, attributes = {})
72
+ # @see https://api.niland.io/doc/users#add-a-user-dislike
73
+ def add_dislike(user, attributes = {})
82
74
  Extra.validate_mandatory_attributes(attributes, [:track])
83
- response = client.post("1.0/users/#{user}/dislikes", attributes)
84
- Struct::Track.new(response)
75
+ response = client.post("2.0/users/#{user}/dislikes", attributes)
76
+ Struct::Track.new(response['track'])
85
77
  end
86
78
  end
87
79
  end
data/lib/siilar/struct.rb CHANGED
@@ -14,9 +14,10 @@ end
14
14
 
15
15
  require 'siilar/struct/album'
16
16
  require 'siilar/struct/artist'
17
- require 'siilar/struct/external_track'
18
17
  require 'siilar/struct/radio'
18
+ require 'siilar/struct/suggestion'
19
19
  require 'siilar/struct/tag'
20
20
  require 'siilar/struct/tag_collection'
21
+ require 'siilar/struct/temporary_track'
21
22
  require 'siilar/struct/track'
22
23
  require 'siilar/struct/user'
@@ -0,0 +1,28 @@
1
+ module Siilar
2
+ module Struct
3
+
4
+ class Suggestion < Base
5
+ attr_accessor :similar_artists, :similar_tracks, :artists, :albums
6
+
7
+ def tags
8
+ @tags ||= []
9
+ end
10
+
11
+ def tags=(attrs)
12
+ if attrs
13
+ @tags = attrs.map { |tag| Struct::Tag.new(tag) }
14
+ end
15
+ end
16
+
17
+ def tracks
18
+ @tracks ||= []
19
+ end
20
+
21
+ def tracks=(attrs)
22
+ if attrs
23
+ @tracks = attrs.map { |track| Struct::Track.new(track) }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,7 +2,17 @@ module Siilar
2
2
  module Struct
3
3
 
4
4
  class Tag < Base
5
- attr_accessor :id, :title
5
+ attr_accessor :id, :title, :synonyms
6
+
7
+ def tag_collection
8
+ @tag_collection ||= []
9
+ end
10
+
11
+ def tag_collection=(attrs)
12
+ if attrs
13
+ @tag_collection = Struct::TagCollection.new(attrs)
14
+ end
15
+ end
6
16
  end
7
17
  end
8
18
  end
@@ -0,0 +1,8 @@
1
+ module Siilar
2
+ module Struct
3
+
4
+ class TemporaryTrack < Base
5
+ attr_accessor :id, :title
6
+ end
7
+ end
8
+ end
@@ -2,7 +2,7 @@ module Siilar
2
2
  module Struct
3
3
 
4
4
  class Track < Base
5
- attr_accessor :id, :hash, :title, :popularity, :duration, :external_id, :isrc, :year
5
+ attr_accessor :id, :title, :popularity, :duration, :reference, :isrc, :year, :created_at, :tags
6
6
 
7
7
  def album
8
8
  @album ||= {}
@@ -2,7 +2,7 @@ module Siilar
2
2
  module Struct
3
3
 
4
4
  class User < Base
5
- attr_accessor :external_id, :birthdate, :gender, :country, :city
5
+ attr_accessor :reference, :birthdate, :gender, :country, :city
6
6
  end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Siilar
2
- VERSION = '1.4.0'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siilar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehdi Lahmam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -96,10 +96,11 @@ files:
96
96
  - lib/siilar/struct.rb
97
97
  - lib/siilar/struct/album.rb
98
98
  - lib/siilar/struct/artist.rb
99
- - lib/siilar/struct/external_track.rb
100
99
  - lib/siilar/struct/radio.rb
100
+ - lib/siilar/struct/suggestion.rb
101
101
  - lib/siilar/struct/tag.rb
102
102
  - lib/siilar/struct/tag_collection.rb
103
+ - lib/siilar/struct/temporary_track.rb
103
104
  - lib/siilar/struct/track.rb
104
105
  - lib/siilar/struct/user.rb
105
106
  - lib/siilar/version.rb
@@ -1,8 +0,0 @@
1
- module Siilar
2
- module Struct
3
-
4
- class ExternalTrack < Base
5
- attr_accessor :artist, :title, :external_id, :image_url, :album
6
- end
7
- end
8
- end