Class: IODConnector
- Inherits:
-
Object
- Object
- IODConnector
- Defined in:
- lib/iodruby.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other_object) ⇒ Object
- #config ⇒ Object
- #create(type = "web", config = Hash.new, destination = "", schedule = "", description = "") ⇒ Object
- #delete ⇒ Object
-
#initialize(name, client = nil) ⇒ IODConnector
constructor
A new instance of IODConnector.
- #status ⇒ Object
- #update(type = "web", config = Hash.new, destination = "", schedule = "", description = "") ⇒ Object
Constructor Details
#initialize(name, client = nil) ⇒ IODConnector
Returns a new instance of IODConnector.
219 220 221 222 |
# File 'lib/iodruby.rb', line 219 def initialize(name,client=nil) @name=name @client=client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
215 216 217 |
# File 'lib/iodruby.rb', line 215 def client @client end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
216 217 218 |
# File 'lib/iodruby.rb', line 216 def name @name end |
Instance Method Details
#==(other_object) ⇒ Object
266 267 268 |
# File 'lib/iodruby.rb', line 266 def ==(other_object) comparison_object.equal?(self) || (comparison_object.instance_of?(self.class) && @name == other_object.name) end |
#config ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/iodruby.rb', line 233 def config(method,type="",config="", destination="", schedule="",description="") data=Hash.new data[:connector]=@name if type!="" data[:type]=type end if config!="" data[:config]=JSON.dump config end if destination!="" destination={"action"=>"addtotextindex", "index" => destination } data[:destination]=JSON.dump destination end if schedule != "" data[:schedule]=JSON.dump schedule end data[:description]=description result=@client.post(method,data) puts result end |
#create(type = "web", config = Hash.new, destination = "", schedule = "", description = "") ⇒ Object
224 225 226 |
# File 'lib/iodruby.rb', line 224 def create(type="web",config=Hash.new, destination="", schedule="",description="") config("addtotextindex",type,config,destination,schedule,description) end |
#delete ⇒ Object
254 255 256 |
# File 'lib/iodruby.rb', line 254 def delete() @client.deleteConnector(@name) end |
#status ⇒ Object
262 263 264 |
# File 'lib/iodruby.rb', line 262 def status() @client.connectorStatus(@name) end |
#update(type = "web", config = Hash.new, destination = "", schedule = "", description = "") ⇒ Object
229 230 231 |
# File 'lib/iodruby.rb', line 229 def update(type="web",config=Hash.new, destination="", schedule="",description="") config("addtotextindex",type,config,destination,schedule,description) end |