Class: Profile
- Inherits:
-
Object
- Object
- Profile
- Defined in:
- lib/tRuTag.rb
Instance Attribute Summary collapse
-
#tbin ⇒ Object
readonly
To create a profile object you will need to pass in a hash containing the following: type: classname of the corresponding site username: username if this is for input pwd: if it is necessary for the site.
Instance Method Summary collapse
- #add_tags(tbin) ⇒ Object
- #base_all_tags_url ⇒ Object
-
#initialize(prohash) ⇒ Profile
constructor
A new instance of Profile.
- #method_missing(name, *args) ⇒ Object
- #space_replace(tag) ⇒ Object
Constructor Details
#initialize(prohash) ⇒ Profile
Returns a new instance of Profile.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/tRuTag.rb', line 134 def initialize(prohash) begin # Funny I think this started as a case statement and then went to a const_get now it's a case statement again. # In any case this is creating the Site object based on the data passed to us. case prohash['type'] when '43Things', '43Cosas', '43Cose', '43Choses', '43Dinge', '43Coisas' @site = RobotCoop.new(prohash) when 'Yahoo2' @site = Y2.new(prohash) when 'Jots' @site = Jts.new(prohash) when 'Flickr' @site = Flkr.new(prohash) else @site = Site.new(prohash) end rescue ArgumentError Trutag::loggit(2, %{#{$!}}) end if prohash.fetch('mode', 0) == 1 begin (prohash['tbin']) rescue SocketError Trutag::loggit(2, %{IO failed: #{@site.attrib['sitename']}}) rescue Timeout::Error Trutag::loggit(2, %{Timeout:#{@site.attrib['sitename']}}) rescue Trutag::loggit(2, %{}) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#tbin ⇒ Object (readonly)
To create a profile object you will need to pass in a hash containing the following: type: classname of the corresponding site username: username if this is for input pwd: if it is necessary for the site. offline: (optional) The XML file to use instad of the URL
132 133 134 |
# File 'lib/tRuTag.rb', line 132 def tbin @tbin end |
Instance Method Details
#add_tags(tbin) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/tRuTag.rb', line 171 def (tbin) if tbin == nil tbin = Hash.new end begin @site.(tbin) rescue SocketError Trutag::loggit(2, %{IO failed: #{@site.attrib['sitename']} #{$!}}) end end |
#base_all_tags_url ⇒ Object
183 184 185 |
# File 'lib/tRuTag.rb', line 183 def %{http://#{@site.attrib['url']}#{@site.attrib['all_tags_path']}} end |
#space_replace(tag) ⇒ Object
167 168 169 |
# File 'lib/tRuTag.rb', line 167 def space_replace(tag) TagCloudMaker.space_to_plus(tag, @site.attrib['space_replacement']) end |