Class: RobotCoop
Overview
for robot coop sites
Instance Attribute Summary
Attributes inherited from Site
Instance Method Summary collapse
- #add_tags(tbin) ⇒ Object
-
#initialize(params) ⇒ RobotCoop
constructor
By default the config.xml file uses the text API Key of 1234.
Methods inherited from Site
Constructor Details
#initialize(params) ⇒ RobotCoop
By default the config.xml file uses the text API Key of 1234. Please replace this with your own API Key
308 309 310 311 312 313 314 |
# File 'lib/tRuTag.rb', line 308 def initialize(params) #we could be a number of sites so lets require the truth if !params.has_key?('url') || !params.has_key?('sitename') then raise ArgumentError, %{Your RobotCoop site requires a sitename and url attribute} end super end |
Instance Method Details
#add_tags(tbin) ⇒ Object
316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/tRuTag.rb', line 316 def (tbin) require_gem 'r43' required_attribute('api_key') required_attribute('username') if @attrib.has_key?('international') && @attrib['international'] != nil conn = R43::Connection.new(@attrib['api_key'], @attrib['international']) else conn = R43::Connection.new(@attrib['api_key']) end = conn.(@attrib['username']) .each { |i| tbin[i.name.downcase] = tbin.fetch(i.name.downcase, 0) + Integer(i.count)} end |