Net::FlickrのsearchPhotoでtags,machine_tagsも取得できるようにする

/opt/local/lib/ruby/gems/1.8/gems/net-flickr-0.0.1/lib/net/flickr/photo.rb を編集した。

    # flickr.photos.getInfo
    def tags
      #raise NotImplementedError
    end

となっている所を

    def machine_tags
      return @machine_tags
    end


    def tags
      return @tags
    end

    def machine_tags
      return @machine_tags
    end

に書き換える。
さらにparse_xmlメソッドに

        @tags = photo_xml[:tags]
        @machine_tags = photo_xml[:machine_tags]

を追加する。

追加したparse_xmlメソッド

    # Parse a photo xml chunk.
    def parse_xml(photo_xml)
      # Convert photo_xml to an Hpricot::Elem if it isn't one already.
      unless photo_xml.is_a?(Hpricot::Elem)
        photo_xml = Hpricot::XML(photo_xml)
      end
      
      # Figure out what format we're dealing with, since someone at Flickr
      # thought it would be fun to be inconsistent (thanks, whoever you are).
      if photo_xml[:owner] && photo_xml[:ispublic]
        # This is a basic XML chunk.
        @id        = photo_xml[:id]
        @owner     = photo_xml[:owner]
        @secret    = photo_xml[:secret]
        @server    = photo_xml[:server]
        @farm      = photo_xml[:farm]
        @title     = photo_xml[:title]
        @is_public = photo_xml[:ispublic] == '1'
        @is_friend = photo_xml[:isfriend] == '1'
        @is_family = photo_xml[:isfamily] == '1'
        @tags = photo_xml[:tags]
        @machine_tags = photo_xml[:machine_tags]
      
      elsif photo_xml[:url] && photo_xml[:thumb]
        # This is a context XML chunk. It doesn't include visibility info.
        @id        = photo_xml[:id]
        @secret    = photo_xml[:secret]
        @server    = photo_xml[:server]
        @farm      = photo_xml[:farm]
        @title     = photo_xml[:title]
        @is_public = nil
        @is_friend = nil
        @is_family = nil  
        @tags = photo_xml[:tags]
        @machine_tags = photo_xml[:machine_tags]

      
      elsif photo_xml[:originalsecret] && photo_xml.at('owner[@nsid]')
        # This is a detailed XML chunk (probably from flickr.photos.getInfo).
        @id        = photo_xml[:id]
        @owner     = photo_xml.at('owner[@nsid]')
        @secret    = photo_xml[:secret]
        @server    = photo_xml[:server]
        @farm      = photo_xml[:farm]
        @title     = photo_xml.at(:title).inner_text
        @is_public = photo_xml.at('visibility')[:ispublic] == '1'
        @is_friend = photo_xml.at('visibility')[:isfriend] == '1'
        @is_family = photo_xml.at('visibility')[:isfamily] == '1'
        @info_xml  = photo_xml
        @tags = photo_xml[:tags]
        @machine_tags = photo_xml[:machine_tags]

      end
    end