Module: Siilar::Client::Radios
- Included in:
- RadiosService
- Defined in:
- lib/siilar/client/radios.rb
Instance Method Summary collapse
-
#create(attributes = {}) ⇒ Object
Create a radio.
-
#delete(radio, attributes = {}) ⇒ Object
Delete a radio.
-
#edit(radio, attributes = {}) ⇒ Object
Edit a radio.
-
#get(radio) ⇒ Object
Get a radio.
-
#get_next(radio) ⇒ Object
Get next radio tracks.
-
#list ⇒ Object
Get a list of your radios.
-
#notify_ban(radio, attributes = {}) ⇒ Object
Notify a ban.
-
#notify_dislike(radio, attributes = {}) ⇒ Object
Notify a dislike.
-
#notify_favorite(radio, attributes = {}) ⇒ Object
Notify a favorite.
-
#notify_like(radio, attributes = {}) ⇒ Object
Notify a like.
-
#notify_not_played(radio, attributes = {}) ⇒ Object
Notify a not played track.
-
#notify_skip(radio, attributes = {}) ⇒ Object
Notify a skip.
Instance Method Details
#create(attributes = {}) ⇒ Object
Create a radio.
24 25 26 27 |
# File 'lib/siilar/client/radios.rb', line 24 def create(attributes = {}) response = client.post('2.0/radios', attributes) Struct::Radio.new(response) end |
#delete(radio, attributes = {}) ⇒ Object
Delete a radio.
40 41 42 |
# File 'lib/siilar/client/radios.rb', line 40 def delete(radio, attributes = {}) response = client.delete("2.0/radios/#{radio}") end |
#edit(radio, attributes = {}) ⇒ Object
Edit a radio.
32 33 34 35 |
# File 'lib/siilar/client/radios.rb', line 32 def edit(radio, attributes = {}) response = client.patch("2.0/radios/#{radio}", attributes) Struct::Radio.new(response) end |
#get(radio) ⇒ Object
Get a radio.
16 17 18 19 |
# File 'lib/siilar/client/radios.rb', line 16 def get(radio) response = client.get("2.0/radios/#{radio}") Struct::Radio.new(response) end |
#get_next(radio) ⇒ Object
Get next radio tracks
47 48 49 50 |
# File 'lib/siilar/client/radios.rb', line 47 def get_next(radio) response = client.get("2.0/radios/#{radio}/next") response.map { |track| Struct::Track.new(track) } end |
#list ⇒ Object
Get a list of your radios.
8 9 10 11 |
# File 'lib/siilar/client/radios.rb', line 8 def list response = client.get('2.0/radios') response['data'].map { |radio| Struct::Radio.new(radio) } end |
#notify_ban(radio, attributes = {}) ⇒ Object
Notify a ban.
82 83 84 85 86 |
# File 'lib/siilar/client/radios.rb', line 82 def notify_ban(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/bans", attributes) Struct::Radio.new(response) end |
#notify_dislike(radio, attributes = {}) ⇒ Object
Notify a dislike.
73 74 75 76 77 |
# File 'lib/siilar/client/radios.rb', line 73 def notify_dislike(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/dislikes", attributes) Struct::Radio.new(response) end |
#notify_favorite(radio, attributes = {}) ⇒ Object
Notify a favorite.
91 92 93 94 95 |
# File 'lib/siilar/client/radios.rb', line 91 def notify_favorite(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/favorites", attributes) Struct::Radio.new(response) end |
#notify_like(radio, attributes = {}) ⇒ Object
Notify a like.
64 65 66 67 68 |
# File 'lib/siilar/client/radios.rb', line 64 def notify_like(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/likes", attributes) Struct::Radio.new(response) end |
#notify_not_played(radio, attributes = {}) ⇒ Object
Notify a not played track.
100 101 102 103 104 |
# File 'lib/siilar/client/radios.rb', line 100 def notify_not_played(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/notplayed", attributes) Struct::Radio.new(response) end |
#notify_skip(radio, attributes = {}) ⇒ Object
Notify a skip.
55 56 57 58 59 |
# File 'lib/siilar/client/radios.rb', line 55 def notify_skip(radio, attributes = {}) validate_arguments_has_track_or_reference(attributes) response = client.post("2.0/radios/#{radio}/skips", attributes) Struct::Radio.new(response) end |