Module: Siilar::Client::Radios

Included in:
RadiosService
Defined in:
lib/siilar/client/radios.rb

Instance Method Summary collapse

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('1.0/radios', attributes)
  Struct::Radio.new(response)
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("1.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("1.0/radios/#{radio}")
  Struct::Radio.new(response)
end

#get_next(radio) ⇒ Object

Get next radio tracks



40
41
42
43
# File 'lib/siilar/client/radios.rb', line 40

def get_next(radio)
  response = client.get("1.0/radios/#{radio}/next")
  response.map { |track| Struct::Track.new(track) }
end

#listObject

Get a list of your radios.



8
9
10
11
# File 'lib/siilar/client/radios.rb', line 8

def list
  response = client.get('1.0/radios')
  response.map { |radio| Struct::Radio.new(radio) }
end

#notify_dislike(radio, attributes = {}) ⇒ Object

Notify a dislike.



66
67
68
69
70
# File 'lib/siilar/client/radios.rb', line 66

def notify_dislike(radio, attributes = {})
  Extra.validate_mandatory_attributes(attributes, [:track])
  response = client.post("1.0/radios/#{radio}/dislikes", attributes)
  Struct::Radio.new(response)
end

#notify_favorite(radio, attributes = {}) ⇒ Object

Notify a favorite.



75
76
77
78
79
# File 'lib/siilar/client/radios.rb', line 75

def notify_favorite(radio, attributes = {})
  Extra.validate_mandatory_attributes(attributes, [:track])
  response = client.post("1.0/radios/#{radio}/favorites", attributes)
  Struct::Radio.new(response)
end

#notify_like(radio, attributes = {}) ⇒ Object

Notify a like.



57
58
59
60
61
# File 'lib/siilar/client/radios.rb', line 57

def notify_like(radio, attributes = {})
  Extra.validate_mandatory_attributes(attributes, [:track])
  response = client.post("1.0/radios/#{radio}/likes", attributes)
  Struct::Radio.new(response)
end

#notify_skip(radio, attributes = {}) ⇒ Object

Notify a skip.



48
49
50
51
52
# File 'lib/siilar/client/radios.rb', line 48

def notify_skip(radio, attributes = {})
  Extra.validate_mandatory_attributes(attributes, [:track])
  response = client.post("1.0/radios/#{radio}/skips", attributes)
  Struct::Radio.new(response)
end