cloudfactory 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ module CF
20
20
  output.first.final_output.first.entity_relevances_of_document.should eql([[92.12089999999999, 73.8997, 48.079100000000004, 28.9416, 27.1982, 21.1997]])
21
21
  output.first.final_output.first.entity_types_of_document.should eql([["Person", "Person", "Person", "Person", "Country", "Country"]])
22
22
  line.stations.first.worker.class.should eql(CF::RobotWorker)
23
- line.stations.first.worker.reward.should eql(5)
23
+ line.stations.first.worker.reward.should eql(0.5)
24
24
  line.stations.first.worker.number.should eql(1)
25
25
  line.stations.first.worker.settings.should eql({:document => ["Franz Kafka and George Orwell are authors. Ludwig Von Beethoven and Mozart are musicians. China and Japan are countries"]})
26
26
  end
@@ -46,7 +46,7 @@ module CF
46
46
  output.first.final_output.first.entity_relevances_of_document.should eql([[92.12089999999999, 73.8997, 48.079100000000004, 28.9416, 27.1982, 21.1997]])
47
47
  output.first.final_output.first.entity_types_of_document.should eql([["Person", "Person", "Person", "Person", "Country", "Country"]])
48
48
  line.stations.first.worker.class.should eql(CF::RobotWorker)
49
- line.stations.first.worker.reward.should eql(5)
49
+ line.stations.first.worker.reward.should eql(0.5)
50
50
  line.stations.first.worker.number.should eql(1)
51
51
  line.stations.first.worker.settings.should eql({:document => ["Franz Kafka and George Orwell are authors. Ludwig Von Beethoven and Mozart are musicians. China and Japan are countries"]})
52
52
  end
@@ -6,6 +6,10 @@ describe CF::FormField do
6
6
  # WebMock.allow_net_connect!
7
7
  VCR.use_cassette "form-fields/plain-ruby/create-form-fields", :record => :new_episodes do
8
8
  line = CF::Line.new("Digitize-0", "Digitization")
9
+
10
+ input_format = CF::InputFormat.new({:name => "image_url", :required => true, :valid_type => "url"})
11
+ line.input_formats input_format
12
+
9
13
  station = CF::Station.new({:type => "work"})
10
14
  line.stations station
11
15
 
@@ -15,30 +19,30 @@ describe CF::FormField do
15
19
  form = CF::TaskForm.new({:title => "Enter text from a business card image", :instruction => "Describe"})
16
20
  line.stations.first.form = form
17
21
 
18
- form_fields_1 = CF::FormField.new({:label => "First Name", :field_type => "SA", :required => "true"})
22
+ form_fields_1 = CF::FormField.new({:label => "First Name", :field_type => "short_answer", :required => "true"})
19
23
  line.stations.first.form.form_fields form_fields_1
20
- form_fields_2 = CF::FormField.new({:label => "Middle Name", :field_type => "SA"})
24
+ form_fields_2 = CF::FormField.new({:label => "Middle Name", :field_type => "short_answer"})
21
25
  line.stations.first.form.form_fields form_fields_2
22
- form_fields_3 = CF::FormField.new({:label => "Last Name", :field_type => "SA", :required => "true"})
26
+ form_fields_3 = CF::FormField.new({:label => "Last Name", :field_type => "short_answer", :required => "true"})
23
27
  line.stations.first.form.form_fields form_fields_3
24
- form_fields_3 = CF::FormField.new({:label => "Gender", :field_type => "RB", :required => "true", :option_values => ["male","female"]})
28
+ form_fields_3 = CF::FormField.new({:label => "Gender", :field_type => "radio_button", :required => "true", :option_values => ["male","female"]})
25
29
  line.stations.first.form.form_fields form_fields_3
26
30
 
27
31
  line.stations.first.form.form_fields[0].label.should eq("First Name")
28
- line.stations.first.form.form_fields[0].field_type.should eq("SA")
32
+ line.stations.first.form.form_fields[0].field_type.should eq("short_answer")
29
33
  line.stations.first.form.form_fields[0].required.should eq(true)
30
- line.stations.first.form.form_fields[0].form_field_params.should eql({:label => "First Name", :field_type => "SA", :required => "true"})
34
+ line.stations.first.form.form_fields[0].form_field_params.should eql({:label => "First Name", :field_type => "short_answer", :required => "true"})
31
35
  line.stations.first.form.form_fields[1].label.should eq("Middle Name")
32
- line.stations.first.form.form_fields[1].field_type.should eq("SA")
33
- line.stations.first.form.form_fields[1].form_field_params.should eql({:label => "Middle Name", :field_type => "SA"})
36
+ line.stations.first.form.form_fields[1].field_type.should eq("short_answer")
37
+ line.stations.first.form.form_fields[1].form_field_params.should eql({:label => "Middle Name", :field_type => "short_answer"})
34
38
  line.stations.first.form.form_fields[2].label.should eq("Last Name")
35
- line.stations.first.form.form_fields[2].field_type.should eq("SA")
39
+ line.stations.first.form.form_fields[2].field_type.should eq("short_answer")
36
40
  line.stations.first.form.form_fields[2].required.should eq(true)
37
- line.stations.first.form.form_fields[2].form_field_params.should eql({:label => "Last Name", :field_type => "SA", :required => "true"})
41
+ line.stations.first.form.form_fields[2].form_field_params.should eql({:label => "Last Name", :field_type => "short_answer", :required => "true"})
38
42
  line.stations.first.form.form_fields[3].label.should eq("Gender")
39
- line.stations.first.form.form_fields[3].field_type.should eq("RB")
43
+ line.stations.first.form.form_fields[3].field_type.should eq("radio_button")
40
44
  line.stations.first.form.form_fields[3].required.should eq(true)
41
- line.stations.first.form.form_fields[3].form_field_params.should eql({:label => "Gender", :field_type => "RB", :required => "true", :option_values => ["male","female"]})
45
+ line.stations.first.form.form_fields[3].form_field_params.should eql({:label => "Gender", :field_type => "radio_button", :required => "true", :option_values => ["male","female"]})
42
46
  end
43
47
  end
44
48
 
@@ -50,10 +54,10 @@ describe CF::FormField do
50
54
  CF::Station.create({:line => self, :type => "work"}) do |station|
51
55
  CF::HumanWorker.new({:station => station, :number => 2, :reward => 20})
52
56
  CF::TaskForm.create({:station => station, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
53
- CF::FormField.new({:form => i, :label => "First Name", :field_type => "SA", :required => "true"})
54
- CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "SA"})
55
- CF::FormField.new({:form => i, :label => "Last Name", :field_type => "SA", :required => "true"})
56
- CF::FormField.new({:form => i, :label => "Gender", :field_type => "RB", :required => "true", :option_values => ["male","female"]})
57
+ CF::FormField.new({:form => i, :label => "First Name", :field_type => "short_answer", :required => "true"})
58
+ CF::FormField.new({:form => i, :label => "Middle Name", :field_type => "short_answer"})
59
+ CF::FormField.new({:form => i, :label => "Last Name", :field_type => "short_answer", :required => "true"})
60
+ CF::FormField.new({:form => i, :label => "Gender", :field_type => "radio_button", :required => "true", :option_values => ["male","female"]})
57
61
  end
58
62
  end
59
63
  end
@@ -64,20 +68,20 @@ describe CF::FormField do
64
68
  line.stations.first.worker.number.should eq(2)
65
69
  line.stations.first.form.instruction.should eq("Describe")
66
70
  line.stations.first.form.form_fields[0].label.should eq("First Name")
67
- line.stations.first.form.form_fields[0].field_type.should eq("SA")
71
+ line.stations.first.form.form_fields[0].field_type.should eq("short_answer")
68
72
  line.stations.first.form.form_fields[0].required.should eq(true)
69
- line.stations.first.form.form_fields[0].form_field_params.should eql({:label => "First Name", :field_type => "SA", :required => "true"})
73
+ line.stations.first.form.form_fields[0].form_field_params.should eql({:label => "First Name", :field_type => "short_answer", :required => "true"})
70
74
  line.stations.first.form.form_fields[1].label.should eq("Middle Name")
71
- line.stations.first.form.form_fields[1].field_type.should eq("SA")
72
- line.stations.first.form.form_fields[1].form_field_params.should eql({:label => "Middle Name", :field_type => "SA"})
75
+ line.stations.first.form.form_fields[1].field_type.should eq("short_answer")
76
+ line.stations.first.form.form_fields[1].form_field_params.should eql({:label => "Middle Name", :field_type => "short_answer"})
73
77
  line.stations.first.form.form_fields[2].label.should eq("Last Name")
74
- line.stations.first.form.form_fields[2].field_type.should eq("SA")
78
+ line.stations.first.form.form_fields[2].field_type.should eq("short_answer")
75
79
  line.stations.first.form.form_fields[2].required.should eq(true)
76
- line.stations.first.form.form_fields[2].form_field_params.should eql({:label => "Last Name", :field_type => "SA", :required => "true"})
80
+ line.stations.first.form.form_fields[2].form_field_params.should eql({:label => "Last Name", :field_type => "short_answer", :required => "true"})
77
81
  line.stations.first.form.form_fields[3].label.should eq("Gender")
78
- line.stations.first.form.form_fields[3].field_type.should eq("RB")
82
+ line.stations.first.form.form_fields[3].field_type.should eq("radio_button")
79
83
  line.stations.first.form.form_fields[3].required.should eq(true)
80
- line.stations.first.form.form_fields[3].form_field_params.should eql({:label => "Gender", :field_type => "RB", :required => "true", :option_values => ["male","female"]})
84
+ line.stations.first.form.form_fields[3].form_field_params.should eql({:label => "Gender", :field_type => "radio_button", :required => "true", :option_values => ["male","female"]})
81
85
  end
82
86
  end
83
87
 
@@ -89,7 +93,7 @@ describe CF::FormField do
89
93
  CF::Station.create({:line => self, :type => "work"}) do |station|
90
94
  CF::HumanWorker.new({:station => station, :number => 2, :reward => 20})
91
95
  CF::TaskForm.create({:station => station, :title => "Enter text from a business card image", :instruction => "Describe"}) do |i|
92
- CF::FormField.new({:form => i, :field_type => "SA", :required => "true"})
96
+ CF::FormField.new({:form => i, :field_type => "short_answer", :required => "true"})
93
97
  end
94
98
  end
95
99
  end
@@ -114,7 +118,7 @@ describe CF::FormField do
114
118
  form = CF::TaskForm.new({:title => "Enter text from a business card image", :instruction => "Describe"})
115
119
  line.stations.first.form = form
116
120
 
117
- form_fields_1 = CF::FormField.new({:field_type => "SA", :required => "true"})
121
+ form_fields_1 = CF::FormField.new({:field_type => "short_answer", :required => "true"})
118
122
  line.stations.first.form.form_fields form_fields_1
119
123
 
120
124
  line.stations.first.type.should eql("WorkStation")
@@ -14,21 +14,18 @@ module CF
14
14
  station = CF::Station.new({:type => "work"})
15
15
  line.stations station
16
16
 
17
- worker = CF::RobotWorker.create({:type => "google_translate_robot", :settings => {:data => ["{text}"], :from => "en", :to => "es"}})
17
+ worker = CF::RobotWorker.create({:type => "google_translate_robot", :settings => {:data => ["{{text}}"], :from => "en", :to => "es"}})
18
18
  line.stations.first.worker = worker
19
19
 
20
20
  form = CF::TaskForm.new({:title => "Enter text", :instruction => "Describe"})
21
21
  line.stations.first.form = form
22
22
 
23
- form_fields = CF::FormField.new({:label => "Description", :field_type => "SA", :required => "true"})
24
- line.stations.first.form.form_fields form_fields
25
23
  line.title.should eql("google_translate_robot")
26
24
  line.stations.first.worker.class.should eql(CF::RobotWorker)
27
25
  line.stations.first.worker.number.should eql(1)
28
- line.stations.first.worker.settings.should eql({:data => ["{text}"], :from => "en", :to => "es"})
26
+ line.stations.first.worker.settings.should eql({:data => ["{{text}}"], :from => "en", :to => "es"})
29
27
  line.stations.first.worker.type.should eql("GoogleTranslateRobot")
30
- run = CF::Run.create(line, "google_translate_robot_run", [{"text"=> "I started loving Monsoon", "meta_data_text"=>"monsoon"}])
31
-
28
+ run = CF::Run.create(line, "google_translate_robot_run", [{"text"=> "I started loving Monsoon"}])
32
29
  @final_output = run.final_output
33
30
  line.stations.first.worker.number.should eq(1)
34
31
  @final_output.first.final_output.first.translation_of_text.should eql('Empecé a amar a Monzón')
@@ -41,18 +38,15 @@ module CF
41
38
  line = CF::Line.create("google_translate_robot_1","Digitization") do |l|
42
39
  CF::InputFormat.new({:line => l, :name => "text", :required => true, :valid_type => "general"})
43
40
  CF::Station.create({:line => l, :type => "work"}) do |s|
44
- CF::RobotWorker.create({:station => s, :type => "google_translate_robot", :settings => {:data => ["{text}"], :from => "en", :to => "es"}})
45
- CF::TaskForm.create({:station => s, :title => "Enter text", :instruction => "Describe"}) do |i|
46
- CF::FormField.new({:form => i, :label => "Description", :field_type => "SA", :required => "true"})
47
- end
41
+ CF::RobotWorker.create({:station => s, :type => "google_translate_robot", :settings => {:data => ["{{text}}"], :from => "en", :to => "es"}})
48
42
  end
49
43
  end
50
44
  line.title.should eql("google_translate_robot_1")
51
45
  line.stations.first.worker.class.should eql(CF::RobotWorker)
52
46
  line.stations.first.worker.number.should eql(1)
53
- line.stations.first.worker.settings.should eql({:data => ["{text}"], :from => "en", :to => "es"})
47
+ line.stations.first.worker.settings.should eql({:data => ["{{text}}"], :from => "en", :to => "es"})
54
48
  line.stations.first.worker.type.should eql("GoogleTranslateRobot")
55
- run = CF::Run.create(line, "google_translate_robot_run_1", [{"text"=> "I started loving Monsoon", "meta_data_text"=>"monsoon"}])
49
+ run = CF::Run.create(line, "google_translate_robot_run_1", [{"text"=> "I started loving Monsoon"}])
56
50
 
57
51
  @final_output = run.final_output
58
52
  line.stations.first.worker.number.should eq(1)
@@ -28,7 +28,7 @@ module CF
28
28
  end
29
29
  end
30
30
  line.stations.first.type.should eql("WorkStation")
31
- line.stations.first.worker.errors.should eql("[\"Reward is not a number\", \"Reward must not contain decimal places\"]")
31
+ line.stations.first.worker.errors.should eql("[\"Reward is not a number\", \"Reward can't be blank\"]")
32
32
  end
33
33
  end
34
34
 
@@ -46,7 +46,7 @@ module CF
46
46
  line.stations.first.worker = worker
47
47
 
48
48
  line.stations.first.type.should eql("WorkStation")
49
- line.stations.first.worker.errors.should eql("[\"Reward is not a number\", \"Reward must not contain decimal places\"]")
49
+ line.stations.first.worker.errors.should eql("[\"Reward is not a number\", \"Reward can't be blank\"]")
50
50
  end
51
51
  end
52
52
 
@@ -89,7 +89,7 @@ module CF
89
89
  line.stations.first.type.should eql("WorkStation")
90
90
  line.stations.first.worker.number.should eql(2)
91
91
  line.stations.first.worker.reward.should eql(20)
92
- line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "speed"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
92
+ line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
93
93
  line.stations.first.worker.stat_badge.should eql({"approval_rating"=>80, "assignment_duration"=>3600, "abandonment_rate"=>30, "country"=>nil})
94
94
  end
95
95
  end
@@ -122,7 +122,7 @@ module CF
122
122
  line.stations.first.type.should eql("WorkStation")
123
123
  line.stations.first.worker.number.should eql(2)
124
124
  line.stations.first.worker.reward.should eql(20)
125
- line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "speed"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
125
+ line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
126
126
  line.stations.first.worker.stat_badge.should eql({"approval_rating"=>80, "assignment_duration"=>3600, "abandonment_rate"=>30, "country"=>nil})
127
127
  end
128
128
  end
@@ -10,18 +10,17 @@ module CF
10
10
  line = CF::Line.create("image_processing_robot","Digitization") do |l|
11
11
  CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
12
12
  CF::Station.create({:line => l, :type => "work"}) do |s|
13
- CF::RobotWorker.create({:station => s, :type => "image_processing_robot", :settings => {:image => ["{url}"], :sharpen => {:radius => "10"}}})
13
+ CF::RobotWorker.create({:station => s, :type => "image_processing_robot", :settings => {:image => ["{{url}}"], :sharpen => {:radius => "10"}}})
14
14
  end
15
15
  end
16
16
  run = CF::Run.create(line, "image_processing_robot_run", [{"url"=> "http://wwwdelivery.superstock.com/WI/223/1527/PreviewComp/SuperStock_1527R-020214.jpg"}])
17
17
  output = run.final_output
18
18
  converted_url = output.first.final_output.first.processed_image_of_url
19
19
  File.exist?("/Users/manish/apps/cloudfactory/public#{converted_url}").should eql(true)
20
- output.first.final_output.first.sharpen.radius.should eql("10")
21
20
  line.stations.first.worker.class.should eql(CF::RobotWorker)
22
- line.stations.first.worker.reward.should eql(0)
21
+ line.stations.first.worker.reward.should eql(0.01)
23
22
  line.stations.first.worker.number.should eql(1)
24
- line.stations.first.worker.settings.should eql({:image => ["{url}"], :sharpen => {:radius => "10"}})
23
+ line.stations.first.worker.settings.should eql({:image => ["{{url}}"], :sharpen => {:radius => "10"}})
25
24
  line.stations.first.worker.type.should eql("ImageProcessingRobot")
26
25
  end
27
26
  end
@@ -36,18 +35,17 @@ module CF
36
35
  station = CF::Station.new({:type => "work"})
37
36
  line.stations station
38
37
 
39
- worker = CF::RobotWorker.create({:type => "image_processing_robot", :settings => {:image => ["{url}"], :sharpen => {:radius => "10"}}})
38
+ worker = CF::RobotWorker.create({:type => "image_processing_robot", :settings => {:image => ["{{url}}"], :sharpen => {:radius => "10"}}})
40
39
  line.stations.first.worker = worker
41
40
 
42
41
  run = CF::Run.create(line, "image_processing_robot_run_1", [{"url"=> "http://wwwdelivery.superstock.com/WI/223/1527/PreviewComp/SuperStock_1527R-020214.jpg"}])
43
42
  output = run.final_output
44
43
  converted_url = output.first.final_output.first.processed_image_of_url
45
44
  File.exist?("/Users/manish/apps/cloudfactory/public#{converted_url}").should eql(true)
46
- output.first.final_output.first.sharpen.radius.should eql("10")
47
45
  line.stations.first.worker.class.should eql(CF::RobotWorker)
48
- line.stations.first.worker.reward.should eql(0)
46
+ line.stations.first.worker.reward.should eql(0.01)
49
47
  line.stations.first.worker.number.should eql(1)
50
- line.stations.first.worker.settings.should eql({:image => ["{url}"], :sharpen => {:radius => "10"}})
48
+ line.stations.first.worker.settings.should eql({:image => ["{{url}}"], :sharpen => {:radius => "10"}})
51
49
  line.stations.first.worker.type.should eql("ImageProcessingRobot")
52
50
  end
53
51
  end
@@ -10,10 +10,10 @@ module CF
10
10
  line = CF::Line.create("keyword_matching_robot","Digitization") do |l|
11
11
  CF::InputFormat.new({:line => l, :name => "url", :valid_type => "url", :required => "true"})
12
12
  CF::Station.create({:line => l, :type => "work"}) do |s|
13
- CF::RobotWorker.create({:station => s, :type => "text_extraction_robot", :settings => {:url => ["{url}"]}})
13
+ CF::RobotWorker.create({:station => s, :type => "text_extraction_robot", :settings => {:url => ["{{url}}"]}})
14
14
  end
15
15
  CF::Station.create({:line => l, :type => "work"}) do |s1|
16
- CF::RobotWorker.create({:station => s1, :type => "keyword_matching_robot", :settings => {:content => ["{contents_of_url}"], :keywords => ["SaaS","see","additional","deepak","saroj"]}})
16
+ CF::RobotWorker.create({:station => s1, :type => "keyword_matching_robot", :settings => {:content => ["{{contents_of_url}}"], :keywords => ["SaaS","see","additional","deepak","saroj"]}})
17
17
  end
18
18
  end
19
19
  run = CF::Run.create(line, "keyword_matching_robot_run", [{"url"=> "http://techcrunch.com/2011/07/26/with-v2-0-assistly-brings-a-simple-pricing-model-rewards-and-a-bit-of-free-to-customer-service-software"}])
@@ -21,14 +21,14 @@ module CF
21
21
  output.first.final_output.first.included_keywords_count_in_contents_of_url.should eql(["3", "2", "2"])
22
22
  output.first.final_output.first.keyword_included_in_contents_of_url.should eql(["SaaS", "see", "additional"])
23
23
  line.stations.first.worker.class.should eql(CF::RobotWorker)
24
- line.stations.first.worker.reward.should eql(1)
24
+ line.stations.first.worker.reward.should eql(0.5)
25
25
  line.stations.first.worker.number.should eql(1)
26
- line.stations.first.worker.settings.should eql({:url => ["{url}"]})
26
+ line.stations.first.worker.settings.should eql({:url => ["{{url}}"]})
27
27
  line.stations.first.worker.type.should eql("TextExtractionRobot")
28
28
  line.stations.last.worker.class.should eql(CF::RobotWorker)
29
- line.stations.last.worker.reward.should eql(1)
29
+ line.stations.last.worker.reward.should eql(0.5)
30
30
  line.stations.last.worker.number.should eql(1)
31
- line.stations.last.worker.settings.should eql({:content => ["{contents_of_url}"], :keywords => ["SaaS","see","additional","deepak","saroj"]})
31
+ line.stations.last.worker.settings.should eql({:content => ["{{contents_of_url}}"], :keywords => ["SaaS","see","additional","deepak","saroj"]})
32
32
  line.stations.last.worker.type.should eql("KeywordMatchingRobot")
33
33
  end
34
34
  end
@@ -43,13 +43,13 @@ module CF
43
43
  station = CF::Station.new({:type => "work"})
44
44
  line.stations station
45
45
 
46
- worker = CF::RobotWorker.create({:type => "text_extraction_robot", :settings => {:url => ["{url}"]}})
46
+ worker = CF::RobotWorker.create({:type => "text_extraction_robot", :settings => {:url => ["{{url}}"]}})
47
47
  line.stations.first.worker = worker
48
48
 
49
49
  station_1 = CF::Station.new({:type => "work"})
50
50
  line.stations station
51
51
 
52
- worker = CF::RobotWorker.create({:type => "keyword_matching_robot", :settings => {:content => ["{contents_of_url}"], :keywords => ["SaaS","see","additional","deepak","saroj"]}})
52
+ worker = CF::RobotWorker.create({:type => "keyword_matching_robot", :settings => {:content => ["{{contents_of_url}}"], :keywords => ["SaaS","see","additional","deepak","saroj"]}})
53
53
  line.stations.last.worker = worker
54
54
 
55
55
  run = CF::Run.create(line, "keyword_matching_robot_run_1", [{"url"=> "http://techcrunch.com/2011/07/26/with-v2-0-assistly-brings-a-simple-pricing-model-rewards-and-a-bit-of-free-to-customer-service-software"}])
@@ -57,14 +57,14 @@ module CF
57
57
  output.first.final_output.first.included_keywords_count_in_contents_of_url.should eql(["3", "2", "2"])
58
58
  output.first.final_output.first.keyword_included_in_contents_of_url.should eql(["SaaS", "see", "additional"])
59
59
  line.stations.first.worker.class.should eql(CF::RobotWorker)
60
- line.stations.first.worker.reward.should eql(1)
60
+ line.stations.first.worker.reward.should eql(0.5)
61
61
  line.stations.first.worker.number.should eql(1)
62
- line.stations.first.worker.settings.should eql({:url => ["{url}"]})
62
+ line.stations.first.worker.settings.should eql({:url => ["{{url}}"]})
63
63
  line.stations.first.worker.type.should eql("TextExtractionRobot")
64
64
  line.stations.last.worker.class.should eql(CF::RobotWorker)
65
- line.stations.last.worker.reward.should eql(1)
65
+ line.stations.last.worker.reward.should eql(0.5)
66
66
  line.stations.last.worker.number.should eql(1)
67
- line.stations.last.worker.settings.should eql({:content => ["{contents_of_url}"], :keywords => ["SaaS","see","additional","deepak","saroj"]})
67
+ line.stations.last.worker.settings.should eql({:content => ["{{contents_of_url}}"], :keywords => ["SaaS","see","additional","deepak","saroj"]})
68
68
  line.stations.last.worker.type.should eql("KeywordMatchingRobot")
69
69
  end
70
70
  end
@@ -90,7 +90,7 @@ describe CF::Line do
90
90
  line.stations.first.form.instruction.should eq("Describe")
91
91
  line.stations.first.form.form_fields.first.label.should eq("First Name")
92
92
  line.stations.first.form.form_fields.first.field_type.should eq("SA")
93
- line.stations.first.form.form_fields.first.required.should eq(true)
93
+ line.stations.first.form.form_fields.first.required.should eq("true")
94
94
  end
95
95
  end
96
96
  end
@@ -157,24 +157,6 @@ describe CF::Line do
157
157
 
158
158
  end
159
159
 
160
- context "Updating a line" do
161
- it "updates an existing line" do
162
- # WebMock.allow_net_connect!
163
- VCR.use_cassette "lines/block/update-line", :record => :new_episodes do
164
- line = CF::Line.new("Digitizd-14", "Digitization", {:public => true, :description => "this is description"})
165
- line.update({:title => "Newtitle-1", :department_name => "Survey", :description => "this is new description"})
166
- updated_line = CF::Line.info(line)
167
- updated_line.title.should eql("newtitle-1")
168
- updated_line.title.should_not eql("digitizd-14")
169
- # department is not updated
170
- # updated_line.department_name.should eql("Survey")
171
- # updated_line.department_name.should_not eql("Digitization")
172
- updated_line.description.should eql("this is new description")
173
- updated_line.description.should_not eql("this is description")
174
- end
175
- end
176
- end
177
-
178
160
  context "deleting" do
179
161
  it "should delete a line" do
180
162
  # WebMock.allow_net_connect!
@@ -223,13 +205,13 @@ describe CF::Line do
223
205
  line.stations.first.form.instruction.should eq("Describe")
224
206
  line.stations.first.form.form_fields[0].label.should eq("First Name")
225
207
  line.stations.first.form.form_fields[0].field_type.should eq("SA")
226
- line.stations.first.form.form_fields[0].required.should eq(true)
208
+ line.stations.first.form.form_fields[0].required.should eq("true")
227
209
  line.stations.first.form.form_fields[1].label.should eq("Middle Name")
228
210
  line.stations.first.form.form_fields[1].field_type.should eq("SA")
229
211
  line.stations.first.form.form_fields[1].required.should eq(nil)
230
212
  line.stations.first.form.form_fields[2].label.should eq("Last Name")
231
213
  line.stations.first.form.form_fields[2].field_type.should eq("SA")
232
- line.stations.first.form.form_fields[2].required.should eq(true)
214
+ line.stations.first.form.form_fields[2].required.should eq("true")
233
215
  end
234
216
  end
235
217
  end
@@ -265,6 +247,7 @@ describe CF::Line do
265
247
  # WebMock.allow_net_connect!
266
248
  VCR.use_cassette "lines/plain-ruby/create-form", :record => :new_episodes do
267
249
  line = CF::Line.new("Diggard-1", "Digitization")
250
+ CF::InputFormat.new({:line => line, :name => "image_url", :required => true, :valid_type => "url"})
268
251
  station = CF::Station.new({:type => "work"})
269
252
  line.stations station
270
253
 
@@ -287,9 +270,9 @@ describe CF::Line do
287
270
  line.input_formats input_format
288
271
  station = CF::Station.new({:type => "work"})
289
272
  line.stations station
290
- line.stations.first.input_formats.first['name'].should eq("image_url")
291
- line.stations.first.input_formats.first['required'].should eq(true)
292
- line.stations.first.input_formats.first['valid_type'].should eq("url")
273
+ line.input_formats.first.name.should eq("image_url")
274
+ line.input_formats.first.required.should eq(true)
275
+ line.input_formats.first.valid_type.should eq("url")
293
276
  end
294
277
  end
295
278
 
@@ -297,6 +280,7 @@ describe CF::Line do
297
280
  # WebMock.allow_net_connect!
298
281
  VCR.use_cassette "lines/plain-ruby/create-form-fields", :record => :new_episodes do
299
282
  line = CF::Line.new("Digitized-4", "Digitization")
283
+ CF::InputFormat.new({:line => line, :name => "image_url", :required => true, :valid_type => "url"})
300
284
  station = CF::Station.new({:type => "work"})
301
285
  line.stations station
302
286
 
@@ -306,20 +290,20 @@ describe CF::Line do
306
290
  form = CF::TaskForm.new({:title => "Enter text from a business card image", :instruction => "Describe"})
307
291
  line.stations.first.form = form
308
292
 
309
- form_fields_1 = CF::FormField.new({:label => "First Name", :field_type => "SA", :required => "true"})
293
+ form_fields_1 = CF::FormField.new({:label => "First Name", :field_type => "short_answer", :required => "true"})
310
294
  line.stations.first.form.form_fields form_fields_1
311
- form_fields_2 = CF::FormField.new({:label => "Middle Name", :field_type => "SA"})
295
+ form_fields_2 = CF::FormField.new({:label => "Middle Name", :field_type => "short_answer"})
312
296
  line.stations.first.form.form_fields form_fields_2
313
- form_fields_3 = CF::FormField.new({:label => "Last Name", :field_type => "SA", :required => "true"})
297
+ form_fields_3 = CF::FormField.new({:label => "Last Name", :field_type => "short_answer", :required => "true"})
314
298
  line.stations.first.form.form_fields form_fields_3
315
299
 
316
300
  line.stations.first.form.form_fields[0].label.should eql("First Name")
317
- line.stations.first.form.form_fields[0].field_type.should eq("SA")
301
+ line.stations.first.form.form_fields[0].field_type.should eq("short_answer")
318
302
  line.stations.first.form.form_fields[0].required.should eq(true)
319
303
  line.stations.first.form.form_fields[1].label.should eql("Middle Name")
320
- line.stations.first.form.form_fields[1].field_type.should eq("SA")
304
+ line.stations.first.form.form_fields[1].field_type.should eq("short_answer")
321
305
  line.stations.first.form.form_fields[2].label.should eql("Last Name")
322
- line.stations.first.form.form_fields[2].field_type.should eq("SA")
306
+ line.stations.first.form.form_fields[2].field_type.should eq("short_answer")
323
307
  line.stations.first.form.form_fields[2].required.should eq(true)
324
308
  end
325
309
  end
@@ -331,7 +315,7 @@ describe CF::Line do
331
315
  VCR.use_cassette "lines/plain-ruby/create-line-with-used-title", :record => :new_episodes do
332
316
  line = CF::Line.new("new_line", "Digitization")
333
317
  line_1 = CF::Line.new("new_line", "Digitization")
334
- line_1.errors.should eql("[\"Title is already taken for this account\"]")
318
+ line_1.errors.should eql(["Title is already taken for this account"])
335
319
  end
336
320
  end
337
321
  end
@@ -7,24 +7,21 @@ module CF
7
7
  it "should create mailer robot worker for first station in Block DSL way" do
8
8
  # WebMock.allow_net_connect!
9
9
  VCR.use_cassette "robot_worker/mailer_robot/block/create-worker-single-station", :record => :new_episodes do
10
- @template = "<html><body><h1>Hello {{user}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
10
+ @template = "<html><body><h1>Hello {{to}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
11
11
  line = CF::Line.create("mailer_robot","Digitization") do |l|
12
12
  CF::InputFormat.new({:line => l, :name => "to", :valid_type => "general", :required => "true"})
13
13
  CF::Station.create({:line => l, :type => "work"}) do |s|
14
- CF::RobotWorker.create({:station => s, :type => "mailer_robot", :settings => {:to => ["manish.das@sprout-technology.com"], :template => @template, :template_variables => {"user" =>"Manish"}}})
14
+ CF::RobotWorker.create({:station => s, :type => "mailer_robot", :settings => {:to => ["manish.das@sprout-technology.com"], :template => @template}})
15
15
  end
16
16
  end
17
17
  run = CF::Run.create(line, "mailer_robot_run", [{"to"=> "manish.das@sprout-technology.com"}])
18
18
  output = run.final_output
19
- output.first.final_output.first.recipients_of_to.should eql(["manish.das@sprout-technology.com"])
20
- output.first.final_output.first.sent_message_for_to.should eql(["<html><body><h1>Hello Manish Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"])
21
- output.first.final_output.first.template.should eql("<html><body><h1>Hello {{user}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>")
22
- output.first.final_output.first.template_variables.user.should eql("Manish")
23
- output.first.final_output.first.template_variables.email.should eql("{{email}}")
19
+ output.first.final_output.first.recipients_of_to.should eql([["manish.das@sprout-technology.com"]])
20
+ output.first.final_output.first.sent_message_for_to.should eql(["<html><body><h1>Hello manish.das@sprout-technology.com Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"])
24
21
  line.stations.first.worker.class.should eql(CF::RobotWorker)
25
- line.stations.first.worker.reward.should eql(8)
22
+ line.stations.first.worker.reward.should eql(0.01)
26
23
  line.stations.first.worker.number.should eql(1)
27
- line.stations.first.worker.settings.should eql({:to => ["manish.das@sprout-technology.com"], :template => @template, :template_variables => {"user" =>"Manish"}})
24
+ line.stations.first.worker.settings.should eql({:to => ["manish.das@sprout-technology.com"], :template => @template})
28
25
  line.stations.first.worker.type.should eql("MailerRobot")
29
26
  end
30
27
  end
@@ -32,7 +29,7 @@ module CF
32
29
  it "should create mailer robot worker for first station in a plain ruby way" do
33
30
  # WebMock.allow_net_connect!
34
31
  VCR.use_cassette "robot_worker/mailer_robot/plain-ruby/create-worker-in-first-station", :record => :new_episodes do
35
- @template = "<html><body><h1>Hello {{user}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
32
+ @template = "<html><body><h1>Hello {{to}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"
36
33
  line = CF::Line.new("mailer_robot_1","Digitization")
37
34
  input_format = CF::InputFormat.new({:name => "to", :required => "true", :valid_type => "general"})
38
35
  line.input_formats input_format
@@ -40,20 +37,17 @@ module CF
40
37
  station = CF::Station.new({:type => "work"})
41
38
  line.stations station
42
39
 
43
- worker = CF::RobotWorker.create({:type => "mailer_robot", :settings => {:to => ["manish.das@sprout-technology.com"], :template => @template, :template_variables => {"user" =>"Manish"}}})
40
+ worker = CF::RobotWorker.create({:type => "mailer_robot", :settings => {:to => ["manish.das@sprout-technology.com"], :template => @template}})
44
41
  line.stations.first.worker = worker
45
42
 
46
43
  run = CF::Run.create(line, "mailer_robot_run_1", [{"to"=> "manish.das@sprout-technology.com"}])
47
44
  output = run.final_output
48
- output.first.final_output.first.recipients_of_to.should eql(["manish.das@sprout-technology.com"])
49
- output.first.final_output.first.sent_message_for_to.should eql(["<html><body><h1>Hello Manish Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"])
50
- output.first.final_output.first.template.should eql("<html><body><h1>Hello {{user}} Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>")
51
- output.first.final_output.first.template_variables.user.should eql("Manish")
52
- output.first.final_output.first.template_variables.email.should eql("{{email}}")
45
+ output.first.final_output.first.recipients_of_to.should eql([["manish.das@sprout-technology.com"]])
46
+ output.first.final_output.first.sent_message_for_to.should eql(["<html><body><h1>Hello manish.das@sprout-technology.com Welcome to CLoudfactory!!!!</h1><p>Thanks for using!!!!</p></body></html>"])
53
47
  line.stations.first.worker.class.should eql(CF::RobotWorker)
54
- line.stations.first.worker.reward.should eql(8)
48
+ line.stations.first.worker.reward.should eql(0.01)
55
49
  line.stations.first.worker.number.should eql(1)
56
- line.stations.first.worker.settings.should eql({:to => ["manish.das@sprout-technology.com"], :template => @template, :template_variables => {"user" =>"Manish"}})
50
+ line.stations.first.worker.settings.should eql({:to => ["manish.das@sprout-technology.com"], :template => @template})
57
51
  line.stations.first.worker.type.should eql("MailerRobot")
58
52
  end
59
53
  end