Class: Net::Flickr::Person

### Home Classes Methods

### In Files

- lib/net/flickr/person.rb

### Parent

Object

### Methods

- ::new
- #admin?
- #contact?
- #family?
- #friend?
- #gender
- #groups
- #icon_url
- #ignored?
- #location
- #mobile_url
- #photo_count
- #photo_url
- #photo_views
- #photos
- #pro?
- #profile_url
- #realname
- #rev_contact?
- #rev_family?
- #rev_friend?

### Class/Module Index

Quicksearch

- Net
- Net::Flickr
- Net::Flickr::APIError
- Net::Flickr::Auth
- Net::Flickr::InvalidResponse
- Net::Flickr::List
- Net::Flickr::ListError
- Net::Flickr::People
- Net::Flickr::Person
- Net::Flickr::Photo
- Net::Flickr::PhotoList
- Net::Flickr::Photos
- Net::Flickr::Tag

No matching classes.

# Net::Flickr::Person

### Attributes

id[R]
username[R]

### Public Class Methods

new(flickr, person_xml) click to toggle source

    # File lib/net/flickr/person.rb, line 35
    def initialize(flickr, person_xml)
      @flickr = flickr

      @id       = person_xml['nsid']
      @username = person_xml.at('username').inner_text
      @infoxml  = nil
    end

### Public Instance Methods

admin?() click to toggle source

`true` if this person is a Flickr admin, `false` otherwise.

    # File lib/net/flickr/person.rb, line 48
    def admin?
      infoxml = get_info
      return infoxml['isadmin'] == '1'
    end

contact?() click to toggle source

`true` if this person is a contact of the calling user, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 56
    def contact?
      infoxml = get_info

      if contact = infoxml['contact']
        return contact == '1'
      end

      return false
    end

family?() click to toggle source

`true` if this person is a family member of the calling user, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 69
    def family?
      infoxml = get_info

      if family = infoxml['family']
        return family == '1'
      end

      return false
    end

friend?() click to toggle source

`true` if this person is a friend of the calling user, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 82
    def friend?
      infoxml = get_info

      if friend = infoxml['friend']
        return friend == '1'
      end

      return false
    end

gender() click to toggle source

Gets this person's gender (e.g., 'M'). This method requires authentication with `read` permission and only returns information for contacts of the calling user. In all other cases, it returns `nil`.

    # File lib/net/flickr/person.rb, line 95
    def gender
      infoxml = get_info
      return infoxml['gender']
    end

groups() click to toggle source

TODO: Implement Flickr.person.groups

    # File lib/net/flickr/person.rb, line 101
    def groups
    end

icon_url() click to toggle source

Gets the URL of this person's buddy icon.

    # File lib/net/flickr/person.rb, line 105
    def icon_url
      infoxml = get_info

      icon_server = infoxml['iconserver']
      icon_farm   = infoxml['iconfarm']

      if icon_server.to_i <= 0
        return 'http://www.flickr.com/images/buddyicon.jpg'
      else
        return "http://farm#{icon_farm}.static.flickr.com/#{icon_server}/buddyicons/#{@id}.jpg"
      end
    end

ignored?() click to toggle source

`true` if this person is an ignored contact of the calling user, `false` otherwise. This method requires authentication with `read` permission and only returns information for contacts of the calling user. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 122
    def ignored?
      infoxml = get_info

      if ignored = infoxml['ignored']
        return ignored == '1'
      end

      return false
    end

location() click to toggle source

Gets this person's location.

    # File lib/net/flickr/person.rb, line 133
    def location
      infoxml = get_info
      return infoxml.at('location').inner_text
    end

mobile_url() click to toggle source

Gets the mobile URL of this person's photos.

    # File lib/net/flickr/person.rb, line 139
    def mobile_url
      infoxml = get_info
      return infoxml.at('mobileurl').inner_text
    end

photo_count() click to toggle source

Gets the total number of photos uploaded by this user.

    # File lib/net/flickr/person.rb, line 145
    def photo_count
      infoxml = get_info
      return infoxml.at('photos/count').inner_text.to_i
    end

photo_url() click to toggle source

Gets the URL of this person's photo stream.

    # File lib/net/flickr/person.rb, line 151
    def photo_url
      infoxml = get_info
      return infoxml.at('photosurl').inner_text
    end

photo_views() click to toggle source

Gets the number of times this person's photo stream has been viewed. This method requires authentication with `read` permission and only returns information for the calling user. In all other cases, it returns `nil`.

    # File lib/net/flickr/person.rb, line 159
    def photo_views
      infoxml = get_info

      if views = infoxml.at('photos/views')
        return views.inner_text.to_i
      end

      return nil
    end

photos(args = {}) click to toggle source

Gets a list of public photos for this person.

See flickr.com/services/api/flickr.people.getPublicPhotos.html for details.

    # File lib/net/flickr/person.rb, line 173
    def photos(args = {})
      return @flickr.photos.user(@id, args)
    end

pro?() click to toggle source

`true` if this person is a Flickr Pro user, `false` otherwise.

    # File lib/net/flickr/person.rb, line 178
    def pro?
      infoxml = get_info
      return infoxml['ispro'] == '1'
    end

profile_url() click to toggle source

Gets the URL of this person's profile.

    # File lib/net/flickr/person.rb, line 184
    def profile_url
      infoxml = get_info
      return infoxml.at('profileurl').inner_text
    end

realname() click to toggle source

Gets this person's real name (e.g., 'John Doe').

    # File lib/net/flickr/person.rb, line 190
    def realname
      infoxml = get_info
      return infoxml.at('realname').inner_text
    end

rev_contact?() click to toggle source

`true` if the calling user is a contact of this person, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 198
    def rev_contact?
      infoxml = get_info

      if rev_contact = infoxml['revcontact']
        return rev_contact == '1'
      end

      return false
    end

rev_family?() click to toggle source

`true` if this person considers the calling user family, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 211
    def rev_family?
      infoxml = get_info

      if rev_family = infoxml['revfamily']
        return rev_family == '1'
      end

      return false
    end

rev_friend?() click to toggle source

`true` if this person considers the calling user a friend, `false` otherwise. This method requires authentication with `read` permission. In all other cases, it returns `false`.

    # File lib/net/flickr/person.rb, line 224
    def rev_friend?
      infoxml = get_info

      if rev_friend = infoxml['revfriend']
        return rev_friend == '1'
      end

      return false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.