Sha256: 176c6ba4b4d8a45c50754390b7b3cb391a063088921a531ac5667b1222c864cb

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

module NTimeLine
  class User < Base
    # user id
    attr_reader :id
    text_data :nickname, :introduction
    url_data :link, :image

    def initialize(doc) #:nodoc:
      elt = doc.root.elements["/response/result/user"]
      super(elt)
      @id = @link.path.split("/").last
    end

    # Fetch a user information by id.
    def self.show(id)
      request("/users/show/#{id}")
    end

    # Fetch a user information by nickname.
    def self.show_by_nickname(name)
      request("/users/show?nickname=#{name}")
    end

    # Fetch a user information corresponding to timeline_key.
    # See http://webservice.nifty.com/timeline/v1/users/me.htm for details.
    # timeline_key:: @nifty TimeLine API key
    def self.me(timeline_key)
      request("/users/me", {:timeline_key => timeline_key})
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ntimeline-0.1.0 lib/ntimeline/user.rb