Sha256: 6fe8042bc45c1f28720f0c02fdc19f276cfd40552b75df9ca033e42f688e6833

Contents?: true

Size: 1.82 KB

Versions: 3

Compression:

Stored size: 1.82 KB

Contents

require 'rexml/xpath'

module UserHelper
  def display_name
    @profile_data['basicprofile']['name']
  end

  def profile_age
    @profile_data['age']
  end

  def profile_city
    @profile_data['city']
  end

  def profile_pic
    @profile_data['basicprofile']['image'].sub(/\/[sl]_/i, '/m_')
  end

  def profile_last_update
    @profile_data['basicprofile']['lastUpdatedDate']
  end

  def profile_headline
    @profile_ext_data['headline']
  end

  def profile_about_me
    @profile_data['aboutme']
  end

  def profile_to_meet
    remove_html(@profile_ext_data['desiretomeet'])
  end

  def profile_name
    remove_html(@profile_data['basicprofile']['name'])
  end

  def profile_interests
    remove_html(@profile_ext_data['interests'])
  end

  def profile_music
    remove_html(@profile_ext_data['music'])
  end

  def profile_movies
    remove_html(@profile_ext_data['movies'])
  end

  def profile_television
    remove_html(@profile_ext_data['television'])
  end

  def profile_books
    remove_html(@profile_ext_data['books'])
  end

  def profile_heroes
    remove_html(@profile_ext_data['heroes'])
  end

  def profile_more_pics
    "http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewAlbums&friendID=#{@userid}"
  end

  def profile_more_vids
    "http://vids.myspace.com/index.cfm?fuseaction=vids.channel&channelID=#{@userid}"
  end

  def profile_more_play
    "http://music.myspace.com/index.cfm?fuseaction=music.singleplaylist&friendid=#{@userid}&plid="
  end

  def remove_html(str)
    return "" unless str
    str.sub(/<.*?>|<.*?\/>|<\/.*?>/, ' ')
  end

  def each_song(doc, &block)
    REXML::XPath.each(doc, '//entry/category[@label="SongUpload" or @label="ProfileSongAdd"]/..', &block)
  end

  def compute_realm
    uri = URI::parse(url_for(:action=>:index, :only_path => false))
    uri.path = '/'
    uri.to_s
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
myspaceid-sdk-0.1.11 samples/rails/sample/app/helpers/user_helper.rb
myspaceid-sdk-0.1.8 samples/rails/sample/app/helpers/user_helper.rb
myspaceid-sdk-0.1.9 samples/rails/sample/app/helpers/user_helper.rb