Class: Flickr::MachineTag

Inherits:
Base
  • Object
show all
Includes:
Validatable
Defined in:
lib/flickr-wrapper/machine_tag.rb

Overview

:nodoc

Defined Under Namespace

Classes: Invalid

Instance Attribute Summary collapse

Attributes inherited from Base

#user_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#machine_tags, #photos, #sets, #tags

Constructor Details

#initialize(namespace, predicate, value) ⇒ MachineTag

Returns a new instance of MachineTag.



9
10
11
# File 'lib/flickr-wrapper/machine_tag.rb', line 9

def initialize(namespace, predicate, value)
  @namespace, @predicate, @value = namespace, predicate, value
end

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



7
8
9
# File 'lib/flickr-wrapper/machine_tag.rb', line 7

def namespace
  @namespace
end

#predicateObject

Returns the value of attribute predicate.



7
8
9
# File 'lib/flickr-wrapper/machine_tag.rb', line 7

def predicate
  @predicate
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/flickr-wrapper/machine_tag.rb', line 7

def value
  @value
end

Class Method Details

.from_s(string) ⇒ Object



17
18
19
# File 'lib/flickr-wrapper/machine_tag.rb', line 17

def self.from_s(string)
  new($1, $2, $3) if string =~ /(.*)\:(.*)\=(.*)/
end

.list(user_id) ⇒ Object



13
14
15
# File 'lib/flickr-wrapper/machine_tag.rb', line 13

def self.list(user_id)
  (Flickr::Query.new(user_id).execute('flickr.tags.getListUser')/:tag).parallel_map(Flickr::MAX_THREADS) {|tag| self.from_s tag.inner_text.to_s }.compact
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/flickr-wrapper/machine_tag.rb', line 21

def to_s
  "#{namespace}:#{predicate}=#{value}"
end