Class: IODConnector

Inherits:
Object
  • Object
show all
Defined in:
lib/iodruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



215
216
217
# File 'lib/iodruby.rb', line 215

def client
  @client
end

#nameObject (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

#configObject



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

#deleteObject



254
255
256
# File 'lib/iodruby.rb', line 254

def delete()
  @client.deleteConnector(@name)
end

#statusObject



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