Class: UClassifyWriteCall
- Inherits:
-
Object
- Object
- UClassifyWriteCall
- Defined in:
- lib/uclassify_write_call.rb
Instance Method Summary collapse
- #add_class(my_class) ⇒ Object
- #add_create_id(create_id) ⇒ Object
- #add_training_class(training_class) ⇒ Object
-
#initialize(write_api_key, classifier_name) ⇒ UClassifyWriteCall
constructor
A new instance of UClassifyWriteCall.
- #to_xml_node(xml_document) ⇒ Object
Constructor Details
#initialize(write_api_key, classifier_name) ⇒ UClassifyWriteCall
Returns a new instance of UClassifyWriteCall.
3 4 5 6 7 8 9 |
# File 'lib/uclassify_write_call.rb', line 3 def initialize (write_api_key,classifier_name) @api_key = write_api_key @classifier_name = classifier_name @createIDs = Array.new @classes = Array.new @training_classes = Array.new end |
Instance Method Details
#add_class(my_class) ⇒ Object
15 16 17 |
# File 'lib/uclassify_write_call.rb', line 15 def add_class my_class @classes << my_class end |
#add_create_id(create_id) ⇒ Object
11 12 13 |
# File 'lib/uclassify_write_call.rb', line 11 def add_create_id create_id @createIDs << create_id end |
#add_training_class(training_class) ⇒ Object
19 20 21 |
# File 'lib/uclassify_write_call.rb', line 19 def add_training_class training_class @training_classes << training_class end |
#to_xml_node(xml_document) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/uclassify_write_call.rb', line 23 def to_xml_node xml_document write_call_node= Nokogiri::XML::Node.new('writeCalls',xml_document) write_call_node['writeApiKey'] = @api_key write_call_node['classifierName']= @classifier_name @createIDs.each do |id| node = id.to_xml_node(xml_document) write_call_node.add_child(node) end @classes.each do |my_class| node = my_class.to_xml_node(xml_document) write_call_node.add_child(node) end @training_classes.each do |training_class| node = training_class.to_xml_node(xml_document) write_call_node.add_child(node) end write_call_node end |