Class: BlipFm::Blip

Inherits:
Object
  • Object
show all
Defined in:
lib/blipfm.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, media_url, owner, artist, title, create_time, message, unix_time, to_user_id, type, status, reblip_id, thumbplay_url, via, via_url, bitrate, genre, is_favorite) ⇒ Blip

Returns a new instance of Blip.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/blipfm.rb', line 256

def initialize(id, media_url, owner, artist, title, create_time, message, unix_time, to_user_id, type, status, reblip_id, thumbplay_url, via, via_url, bitrate, genre, is_favorite)
  @id = if_nill(id).strip
  @media_url = if_nill(media_url).strip
  @owner = owner
  @artist = if_nill(artist).strip
  @title = if_nill(title).strip
  @create_time = if_nill(create_time).strip
  @message = if_nill(message).strip
  @unix_time = if_nill(unix_time).strip
  @to_user_id = if_nill(to_user_id).strip
  @type = if_nill(type).strip
  @status = if_nill(status).strip
  @reblip_id = if_nill(reblip_id).strip
  @thumbplay_url = if_nill(thumbplay_url).strip
  @via = if_nill(via).strip
  @via_url = if_nill(via_url).strip
  @bitrate = if_nill(bitrate).strip
  @genre = if_nill(genre).strip
  @is_favorite = if_nill(is_favorite).strip
end

Instance Attribute Details

#artistObject (readonly)

Returns the value of attribute artist.



223
224
225
# File 'lib/blipfm.rb', line 223

def artist
  @artist
end

#bitrateObject (readonly)

Returns the value of attribute bitrate.



223
224
225
# File 'lib/blipfm.rb', line 223

def bitrate
  @bitrate
end

#create_timeObject (readonly)

Returns the value of attribute create_time.



223
224
225
# File 'lib/blipfm.rb', line 223

def create_time
  @create_time
end

#genreObject (readonly)

Returns the value of attribute genre.



223
224
225
# File 'lib/blipfm.rb', line 223

def genre
  @genre
end

#idObject (readonly)

Returns the value of attribute id.



223
224
225
# File 'lib/blipfm.rb', line 223

def id
  @id
end

#is_favoriteObject (readonly)

Returns the value of attribute is_favorite.



223
224
225
# File 'lib/blipfm.rb', line 223

def is_favorite
  @is_favorite
end

#media_urlObject (readonly)

Returns the value of attribute media_url.



223
224
225
# File 'lib/blipfm.rb', line 223

def media_url
  @media_url
end

#messageObject (readonly)

Returns the value of attribute message.



223
224
225
# File 'lib/blipfm.rb', line 223

def message
  @message
end

#ownerObject (readonly)

Returns the value of attribute owner.



223
224
225
# File 'lib/blipfm.rb', line 223

def owner
  @owner
end

#reblip_idObject (readonly)

Returns the value of attribute reblip_id.



223
224
225
# File 'lib/blipfm.rb', line 223

def reblip_id
  @reblip_id
end

#statusObject (readonly)

Returns the value of attribute status.



223
224
225
# File 'lib/blipfm.rb', line 223

def status
  @status
end

#thumbplay_urlObject (readonly)

Returns the value of attribute thumbplay_url.



223
224
225
# File 'lib/blipfm.rb', line 223

def thumbplay_url
  @thumbplay_url
end

#titleObject (readonly)

Returns the value of attribute title.



223
224
225
# File 'lib/blipfm.rb', line 223

def title
  @title
end

#to_user_idObject (readonly)

Returns the value of attribute to_user_id.



223
224
225
# File 'lib/blipfm.rb', line 223

def to_user_id
  @to_user_id
end

#typeObject (readonly)

Returns the value of attribute type.



223
224
225
# File 'lib/blipfm.rb', line 223

def type
  @type
end

#unix_timeObject (readonly)

Returns the value of attribute unix_time.



223
224
225
# File 'lib/blipfm.rb', line 223

def unix_time
  @unix_time
end

#viaObject (readonly)

Returns the value of attribute via.



223
224
225
# File 'lib/blipfm.rb', line 223

def via
  @via
end

#via_urlObject (readonly)

Returns the value of attribute via_url.



223
224
225
# File 'lib/blipfm.rb', line 223

def via_url
  @via_url
end

Class Method Details

.create_by_xml(blip_xml) ⇒ Object



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/blipfm.rb', line 225

def Blip.create_by_xml(blip_xml)
  owner = User.create_by_xml(blip_xml.elements['owner'])
  
  if (!blip_xml.elements['id'].nil?)
    id = blip_xml.elements['id'].text
    media_url = blip_xml.elements['url'].text
    artist = blip_xml.elements['artist'].text
    title = blip_xml.elements['title'].text
    create_time = blip_xml.elements['insTime'].text
    message = blip_xml.elements['message'].text
    unix_time = blip_xml.elements['unixTime'].text
    to_user_id = blip_xml.elements['toId'].text
    type = blip_xml.elements['type'].text
    status = blip_xml.elements['status'].text
    reblip_id = blip_xml.elements['reblipId'].text
    thumbplay_url = blip_xml.elements['thumbplayLink'].text
    via = blip_xml.elements['via'].text
    via_url = blip_xml.elements['viaUrl'].text
    bitrate = blip_xml.elements['bitrate'].text
    genre = blip_xml.elements['genre'].text
    is_favorite = nil
    
    Blip.new(id, media_url, owner, artist, title, create_time, message, unix_time, to_user_id, type, status, reblip_id, thumbplay_url, via, via_url, bitrate, genre, is_favorite)
  end
end

.get(id) ⇒ Object



251
252
253
254
# File 'lib/blipfm.rb', line 251

def Blip.get(id)
  blip_xml = REXML::Document.new(BlipFm::execute_blip_method('blip/getById', false, false, {'id' => id})).elements['BlipApiResponse/result/collection/Blip']
  create_by_xml(blip_xml)
end