rhoconnect 4.0.0.beta.10 → 4.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG.md +11 -0
  2. data/Gemfile.lock +6 -6
  3. data/Rakefile +1 -1
  4. data/commands/generators/controller.rb +1 -1
  5. data/commands/generators/model.rb +1 -1
  6. data/doc/deploying.txt +41 -38
  7. data/doc/source-adapters-js.txt +263 -0
  8. data/generators/templates/application/controllers/js/application_controller.js +6 -4
  9. data/generators/templates/source/controllers/js/controller.js +4 -4
  10. data/generators/templates/source/models/js/model.js +3 -1
  11. data/install.sh +76 -6
  12. data/installer/utils/constants.rb +4 -4
  13. data/js-adapters/ballroom.js +6 -7
  14. data/js-adapters/node_channel.rb +14 -8
  15. data/js-adapters/request.js +7 -8
  16. data/js-adapters/response.js +10 -2
  17. data/js-adapters/rhoconnect_helpers.js +34 -33
  18. data/js-adapters/router.js +15 -12
  19. data/lib/rhoconnect/controller/js_base.rb +2 -7
  20. data/lib/rhoconnect/document.rb +1 -1
  21. data/lib/rhoconnect/model/base.rb +25 -10
  22. data/lib/rhoconnect/model/js_base.rb +4 -3
  23. data/lib/rhoconnect/source.rb +15 -1
  24. data/lib/rhoconnect/version.rb +1 -1
  25. data/spec/apps/rhotestapp/models/js/js_sample.js +61 -14
  26. data/spec/apps/rhotestapp/models/ruby/sample_adapter.rb +5 -0
  27. data/spec/controllers/js_base_spec.rb +16 -11
  28. data/spec/models/js_model_spec.rb +68 -7
  29. data/spec/server/server_spec.rb +28 -0
  30. data/spec/source_adapter_spec.rb +0 -11
  31. data/spec/source_spec.rb +39 -0
  32. data/spec/spec_helper.rb +11 -0
  33. metadata +4 -44
  34. data/lib/rhoconnect/api/app/ans_login.rb +0 -3
  35. data/lib/rhoconnect/api/app/bulk_data.rb +0 -10
  36. data/lib/rhoconnect/api/app/fast_delete.rb +0 -11
  37. data/lib/rhoconnect/api/app/fast_insert.rb +0 -11
  38. data/lib/rhoconnect/api/app/fast_update.rb +0 -11
  39. data/lib/rhoconnect/api/app/login.rb +0 -5
  40. data/lib/rhoconnect/api/app/push_deletes.rb +0 -12
  41. data/lib/rhoconnect/api/app/push_objects.rb +0 -12
  42. data/lib/rhoconnect/api/app/query.rb +0 -8
  43. data/lib/rhoconnect/api/app/queue_updates.rb +0 -98
  44. data/lib/rhoconnect/api/app/search.rb +0 -8
  45. data/lib/rhoconnect/api/client/client_get_db_doc.rb +0 -5
  46. data/lib/rhoconnect/api/client/client_set_db_doc.rb +0 -8
  47. data/lib/rhoconnect/api/client/create.rb +0 -7
  48. data/lib/rhoconnect/api/client/get_client_params.rb +0 -4
  49. data/lib/rhoconnect/api/client/list_client_docs.rb +0 -17
  50. data/lib/rhoconnect/api/client/register.rb +0 -12
  51. data/lib/rhoconnect/api/client/reset.rb +0 -5
  52. data/lib/rhoconnect/api/readstate/set_refresh_time.rb +0 -9
  53. data/lib/rhoconnect/api/source/get_source_params.rb +0 -4
  54. data/lib/rhoconnect/api/source/list_sources.rb +0 -16
  55. data/lib/rhoconnect/api/source/update_source_params.rb +0 -6
  56. data/lib/rhoconnect/api/store/get_db_doc.rb +0 -4
  57. data/lib/rhoconnect/api/store/set_db_doc.rb +0 -7
  58. data/lib/rhoconnect/api/system/get_adapter.rb +0 -4
  59. data/lib/rhoconnect/api/system/get_license_info.rb +0 -9
  60. data/lib/rhoconnect/api/system/login.rb +0 -15
  61. data/lib/rhoconnect/api/system/reset.rb +0 -11
  62. data/lib/rhoconnect/api/system/save_adapter.rb +0 -4
  63. data/lib/rhoconnect/api/system/stats.rb +0 -22
  64. data/lib/rhoconnect/api/user/create_user.rb +0 -7
  65. data/lib/rhoconnect/api/user/delete_client.rb +0 -6
  66. data/lib/rhoconnect/api/user/delete_user.rb +0 -11
  67. data/lib/rhoconnect/api/user/list_clients.rb +0 -4
  68. data/lib/rhoconnect/api/user/list_source_docs.rb +0 -11
  69. data/lib/rhoconnect/api/user/list_users.rb +0 -3
  70. data/lib/rhoconnect/api/user/ping.rb +0 -3
  71. data/lib/rhoconnect/api/user/show_user.rb +0 -3
  72. data/lib/rhoconnect/api/user/update_user.rb +0 -5
  73. data/lib/rhoconnect/api/user/user_get_db_doc.rb +0 -5
  74. data/lib/rhoconnect/api/user/user_set_db_doc.rb +0 -10
@@ -1,4 +1,5 @@
1
- var rcHelpers = require('rhoconnect_helpers');
1
+ var rc = require('rhoconnect_helpers');
2
+ var Store = rc.Store;
2
3
 
3
4
  var JsSample = function() {
4
5
 
@@ -8,7 +9,11 @@ var JsSample = function() {
8
9
  };
9
10
 
10
11
  this.create = function(resp){
11
- resp.send('2');
12
+ if(resp.params.create_object['txtfile-rhoblob'] === 'blob_created'){
13
+ resp.send('blob_created');
14
+ } else{
15
+ resp.send('2');
16
+ }
12
17
  };
13
18
 
14
19
  this.update = function(resp){
@@ -28,27 +33,69 @@ var JsSample = function() {
28
33
  resp.send(true);
29
34
  };
30
35
 
31
- this.getUser = function(resp){
32
- rcHelpers.current_user(resp,function(resp){
33
- var current_user = resp['result']["login"];
34
- resp.send(current_user);
36
+ this.testGetValue = function(resp){
37
+ resp.params = 'foo';
38
+ Store.getValue(resp,function(resp){
39
+ resp.send(resp.result);
40
+ });
41
+ };
42
+
43
+ this.testGetData = function(resp){
44
+ resp.params = 'foo';
45
+ Store.getData(resp,function(resp){
46
+ resp.send(resp.result);
47
+ });
48
+ };
49
+
50
+ this.testGetModelData = function(resp){
51
+ rc.getData(resp,function(resp){
52
+ resp.send(resp.result);
53
+ });
54
+ };
55
+
56
+ this.testPutValue = function(resp){
57
+ Store.putValue(resp,function(resp){
58
+ resp.send(resp.result);
35
59
  });
36
60
  };
37
61
 
62
+ this.testPutData = function(resp){
63
+ Store.putData(resp,function(resp){
64
+ resp.send(resp.result);
65
+ });
66
+ };
67
+
68
+ this.getUser = function(resp){
69
+ var user = resp.currentUser;
70
+ resp.send(user);
71
+ };
72
+
38
73
  this.getSource = function(resp){
39
- rcHelpers.source(resp,function(resp){
74
+ rc.source(resp,function(resp){
40
75
  var source = resp['result']['id'];
41
76
  resp.send(source);
42
77
  });
43
78
  };
44
79
 
45
- // var get_stash_result = function(resp){
46
- // resp.params = {"1":{"name":"John"}};
47
- // rc_helpers.stash_result(resp,function(resp){
48
- // var result = {};
49
- // resp.send(result);
50
- // })
51
- // }
80
+ this.testStashResult = function(resp){
81
+ for(var i = 0; i < 2; i++){
82
+ var item = i.toString();
83
+ resp.params = {};
84
+ resp.params[item] = {'name': item};
85
+ rc.stashResult(resp);
86
+ }
87
+ // Master Document now contains { '0': {'name': '0'}, '1': {'name': '1'} }
88
+ resp.send(true);
89
+ };
90
+
91
+ this.storeBlob = function(resp){
92
+ var fs = require('fs');
93
+ if(fs.existsSync(resp.params.path)){
94
+ resp.send('blob_created');
95
+ } else{
96
+ resp.send('no blob');
97
+ }
98
+ };
52
99
 
53
100
  };
54
101
 
@@ -2,6 +2,11 @@ class SampleAdapter < SourceAdapter
2
2
  def initialize(source)
3
3
  super(source)
4
4
  end
5
+
6
+ # to test custom partitions
7
+ def self.partition_name(user_id)
8
+ user_id[0..2] == 'cus' ? 'custom_partition' : user_id
9
+ end
5
10
 
6
11
  def login
7
12
  raise SourceAdapterLoginException.new('Error logging in') if _is_empty?(current_user.login)
@@ -72,18 +72,23 @@ describe "Rhoconnect::Controller::JsBase" do
72
72
  last_response.should be_ok
73
73
  end
74
74
 
75
- it "should register deprecated_route"
76
-
77
- it "should call js model name explicitly" do
78
- js = JsSample.new("JsSample")
79
- res = js.login
80
- res.should == "success"
75
+ it "should upload blob in multipart post" do
76
+ file1,file2 = 'upload1.txt'
77
+ @product1['txtfile-rhoblob'] = file1
78
+ @product1['_id'] = 'tempobj1'
79
+ cud = {'create'=>{'1'=>{'name'=>'hello'}},
80
+ :blob_fields => ['txtfile-rhoblob']}.to_json
81
+ post "/app/#{Rhoconnect::API_VERSION}/JsSample",
82
+ {:cud => cud,'txtfile-rhoblob-1' =>
83
+ Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__),'..','testdata',file1), "application/octet-stream")},
84
+ {Rhoconnect::CLIENT_ID_HEADER => @c.id}
85
+ last_response.should be_ok
86
+ get "/app/#{Rhoconnect::API_VERSION}/JsSample", {}, {Rhoconnect::CLIENT_ID_HEADER => @c.id}
87
+ json = JSON.parse(last_response.body)
88
+ json[5]['links'].should == { "1" => { "l" => "blob_created" } }
89
+ json[5]['delete'].should == { "blob_created" => { "name" => "hello", "txtfile-rhoblob" => "blob_created" } }
81
90
  end
82
91
 
83
- it "should print warning if model function not found" do
84
- js = JsSample.new("JsSample")
85
- res = js.foo
86
- res.should == "foo method not defined for JsSample"
87
- end
92
+ it "should register deprecated_route"
88
93
  end
89
94
  end
@@ -18,22 +18,83 @@ describe "Rhoconnect::Model::JsBase" do
18
18
 
19
19
  after(:each) do
20
20
  Rhoconnect::Node.kill_process
21
+ Source.valid_doctypes.delete('tmpdoc'.to_sym)
21
22
  end
22
23
 
23
- describe "from ruby" do
24
+ it "should call model's create method"
24
25
 
25
- it "should call model's create method from ruby"
26
+ it "should call model's update method"
26
27
 
27
- it "should call model's update method from ruby"
28
+ it "should call model's delete method"
28
29
 
29
- it "should call model's delete method from ruby"
30
+ it "should call model's query method"
30
31
 
31
- it "should call model's query method from ruby"
32
+ it "should call model's login method"
32
33
 
33
- it "should call model's login method from ruby"
34
+ it "should call model's logoff method"
34
35
 
35
- it "should call model's logoff method from ruby"
36
+ it "should call js model method explicitly" do
37
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
38
+ res = js.login
39
+ res.should == "success"
40
+ end
41
+
42
+ it "should print warning if model function not found" do
43
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
44
+ res = js.foo
45
+ res.should == "foo method not defined for JsSample"
46
+ end
47
+
48
+ it "should call currentUser from model" do
49
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
50
+ res = js.getUser
51
+ res.should == 'testuser'
52
+ end
53
+
54
+ it "should call stashResult from model" do
55
+ data = { '0' => {'name' => '0'}, '1' => {'name' => '1'} }
56
+ Source.define_valid_doctypes(['tmpdoc'.to_sym])
57
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
58
+ js.inject_tmpdoc('tmpdoc')
59
+ js.testStashResult
60
+ js.get_data('tmpdoc').should == data
61
+ end
62
+
63
+ it "should call getData for a model" do
64
+ data = {'1' => {'name' => 'iPhone'}}
65
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
66
+ res = js.do_query
67
+ js.testGetModelData.should == data
68
+ end
69
+
70
+ context "Store" do
71
+ it "should call getValue" do
72
+ Store.put_value('foo', 'bar')
73
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
74
+ res = js.testGetValue
75
+ res.should == 'bar'
76
+ end
77
+
78
+ it "should call putValue" do
79
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
80
+ js.testPutValue('foo', 'baz')
81
+ Store.get_value('foo').should == 'baz'
82
+ end
83
+
84
+ it "should call getData" do
85
+ data = {'1' => {'name' => 'iPhone'}}
86
+ Store.put_data('foo', data)
87
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
88
+ res = js.testGetData
89
+ res.should == data
90
+ end
36
91
 
92
+ it "should call putData" do
93
+ data = {'1' => {'name' => 'iPhone'}}
94
+ js = JsSample.new(Source.load('JsSample', {:app_id => @a.id, :user_id => @u.id}))
95
+ res = js.testPutData('foo', data)
96
+ Store.get_data('foo').should == data
97
+ end
37
98
  end
38
99
  end
39
100
  end
@@ -412,6 +412,34 @@ describe "Server" do
412
412
  {"count"=>0}, {"progress_count"=>0}, {"total_count"=>2},{}]
413
413
  end
414
414
 
415
+ # check custom partitions
416
+ it "should return data for user with custom partition name" do
417
+ do_post "/rc/#{Rhoconnect::API_VERSION}/app/login", "login" => 'cus_user1', "password" => 'testpass'
418
+ @c_fields = {
419
+ :device_type => 'Apple',
420
+ :device_pin => 'abcd',
421
+ :device_port => '3333',
422
+ :user_id => 'cus_user1',
423
+ :app_id => @a.id
424
+ }
425
+ @c = Client.create(@c_fields,{:source_name => @s_fields[:name]})
426
+ @s = Source.load('SampleAdapter', {:user_id => 'cus_user1', :app_id => APP_NAME})
427
+
428
+ data = {'1'=>@product1,'2'=>@product2}
429
+ set_test_data('test_db_storage',data)
430
+ get "/app/#{Rhoconnect::API_VERSION}/#{@s.name}", {}, {Rhoconnect::CLIENT_ID_HEADER => @c.id}
431
+ last_response.should be_ok
432
+ token = @c.get_value(:page_token)
433
+ JSON.parse(last_response.body).should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>token},
434
+ {"count"=>2}, {"progress_count"=>0}, {"total_count"=>2},{'insert'=>data}]
435
+ get "/app/#{Rhoconnect::API_VERSION}/#{@s.name}", {:token => token}, {Rhoconnect::CLIENT_ID_HEADER => @c.id}
436
+ last_response.should be_ok
437
+ JSON.parse(last_response.body).should == [{'version'=>Rhoconnect::SYNC_VERSION},{"token"=>''},
438
+ {"count"=>0}, {"progress_count"=>0}, {"total_count"=>2},{}]
439
+ @s.docname(:md).should == "source:#{@s.app.id}:custom_partition:SampleAdapter:md"
440
+ verify_doc_result(@s, :md => data)
441
+ end
442
+
415
443
  it "should create source for dynamic adapter if source_name is unknown" do
416
444
  get "/app/#{Rhoconnect::API_VERSION}/Broken", {}, {Rhoconnect::CLIENT_ID_HEADER => @c.id}
417
445
  last_response.status.should == 200
@@ -1,16 +1,5 @@
1
1
  require File.join(File.dirname(__FILE__),'spec_helper')
2
2
 
3
- class Rhoconnect::Model::Base
4
- def inject_result(result)
5
- @result = result
6
- end
7
-
8
- def inject_tmpdoc(doctype)
9
- @tmp_docname = doctype
10
- @stash_size = 0
11
- end
12
- end
13
-
14
3
  describe "loading Model" do
15
4
  it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
16
5
  it "should load Model instance from user name" do
data/spec/source_spec.rb CHANGED
@@ -114,5 +114,44 @@ describe "Source" do
114
114
  )
115
115
  Source.update_associations([@s.name,@s1.name, @s2.name])
116
116
  end
117
+
118
+ # check custom partitions
119
+ it "should return custom partition for users if defined in the model" do
120
+ u1_fields = {:login => 'cus_user1'}
121
+ u1 = User.create(u1_fields)
122
+ u2_fields = {:login => 'cus_user2'}
123
+ u2 = User.create(u2_fields)
124
+ u3_fields = {:login => 'other_user'}
125
+ u3 = User.create(u3_fields)
126
+
127
+ s = Source.load('SampleAdapter', {:user_id => u1.login, :app_id => APP_NAME})
128
+ s.user_by_partition.should == 'custom_partition'
129
+ s.docname(:md).should == "source:#{s.app.id}:custom_partition:SampleAdapter:md"
130
+ s = Source.load('FixedSchemaAdapter', {:user_id => u1.login, :app_id => APP_NAME})
131
+ s.user_by_partition.should == 'cus_user1'
132
+ s = Source.load('SampleAdapter', {:user_id => u2.login, :app_id => APP_NAME})
133
+ s.user_by_partition.should == 'custom_partition'
134
+ s = Source.load('SampleAdapter', {:user_id => u3.login, :app_id => APP_NAME})
135
+ s.user_by_partition.should == 'other_user'
136
+ end
137
+
138
+ it "should delete data from custom partition" do
139
+ u1_fields = {:login => 'cus_user1'}
140
+ u1 = User.create(u1_fields)
141
+ data = {'1' => {'Name' => 'Value'}}
142
+
143
+ s = Source.load('SampleAdapter', {:user_id => u1.login, :app_id => APP_NAME})
144
+ s.user_by_partition.should == 'custom_partition'
145
+ Source.define_valid_doctypes([:md_source])
146
+ set_doc_state(s, {:md_source => data})
147
+ Store.get_data("source:#{s.app.id}:custom_partition:SampleAdapter:md_source").should == data
148
+ Store.get_data("source:#{s.app.id}:cus_user1:SampleAdapter:md_source").should == {}
149
+ Store.put_data("source:#{s.app.id}:cus_user1:SampleAdapter:md_source", data)
150
+
151
+ s.delete
152
+ Store.get_data("source:#{s.app.id}:custom_partition:SampleAdapter:md_source").should == {}
153
+ Store.get_data("source:#{s.app.id}:cus_user1:SampleAdapter:md_source").should == data
154
+ Source.valid_doctypes.delete(:md_source)
155
+ end
117
156
  end
118
157
  end
data/spec/spec_helper.rb CHANGED
@@ -56,6 +56,17 @@ Dir["#{SPEC_PATH}/support/**/*.rb"].each { |f| require f }
56
56
  ENV['RACK_ENV'] = 'test'
57
57
  ERROR = '0_broken_object_id' unless defined? ERROR
58
58
 
59
+ class Rhoconnect::Model::Base
60
+ def inject_result(result)
61
+ @result = result
62
+ end
63
+
64
+ def inject_tmpdoc(doctype)
65
+ @tmp_docname = doctype
66
+ @stash_size = 0
67
+ end
68
+ end
69
+
59
70
  module TestHelpers
60
71
  def get_testapp_path
61
72
  File.expand_path(File.join(File.dirname(__FILE__),'apps','rhotestapp'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhoconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta.10
4
+ version: 4.0.0.beta.12
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
12
+ date: 2013-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -418,6 +418,7 @@ files:
418
418
  - doc/metadata.txt
419
419
  - doc/rails-plugin.txt
420
420
  - doc/java-plugin.txt
421
+ - doc/source-adapters-js.txt
421
422
  - doc/adapters-intro.txt
422
423
  - doc/migration.txt
423
424
  - doc/stats-middleware.txt
@@ -619,47 +620,6 @@ files:
619
620
  - lib/rhoconnect/version.rb
620
621
  - lib/rhoconnect/user.rb
621
622
  - lib/rhoconnect/stats/record.rb
622
- - lib/rhoconnect/api/system/login.rb
623
- - lib/rhoconnect/api/system/reset.rb
624
- - lib/rhoconnect/api/system/save_adapter.rb
625
- - lib/rhoconnect/api/system/get_license_info.rb
626
- - lib/rhoconnect/api/system/stats.rb
627
- - lib/rhoconnect/api/system/get_adapter.rb
628
- - lib/rhoconnect/api/user/delete_user.rb
629
- - lib/rhoconnect/api/user/user_set_db_doc.rb
630
- - lib/rhoconnect/api/user/update_user.rb
631
- - lib/rhoconnect/api/user/create_user.rb
632
- - lib/rhoconnect/api/user/list_users.rb
633
- - lib/rhoconnect/api/user/user_get_db_doc.rb
634
- - lib/rhoconnect/api/user/list_source_docs.rb
635
- - lib/rhoconnect/api/user/show_user.rb
636
- - lib/rhoconnect/api/user/delete_client.rb
637
- - lib/rhoconnect/api/user/list_clients.rb
638
- - lib/rhoconnect/api/user/ping.rb
639
- - lib/rhoconnect/api/client/client_set_db_doc.rb
640
- - lib/rhoconnect/api/client/list_client_docs.rb
641
- - lib/rhoconnect/api/client/create.rb
642
- - lib/rhoconnect/api/client/register.rb
643
- - lib/rhoconnect/api/client/reset.rb
644
- - lib/rhoconnect/api/client/get_client_params.rb
645
- - lib/rhoconnect/api/client/client_get_db_doc.rb
646
- - lib/rhoconnect/api/app/fast_update.rb
647
- - lib/rhoconnect/api/app/login.rb
648
- - lib/rhoconnect/api/app/fast_insert.rb
649
- - lib/rhoconnect/api/app/query.rb
650
- - lib/rhoconnect/api/app/search.rb
651
- - lib/rhoconnect/api/app/push_objects.rb
652
- - lib/rhoconnect/api/app/queue_updates.rb
653
- - lib/rhoconnect/api/app/ans_login.rb
654
- - lib/rhoconnect/api/app/bulk_data.rb
655
- - lib/rhoconnect/api/app/fast_delete.rb
656
- - lib/rhoconnect/api/app/push_deletes.rb
657
- - lib/rhoconnect/api/readstate/set_refresh_time.rb
658
- - lib/rhoconnect/api/source/get_source_params.rb
659
- - lib/rhoconnect/api/source/list_sources.rb
660
- - lib/rhoconnect/api/source/update_source_params.rb
661
- - lib/rhoconnect/api/store/set_db_doc.rb
662
- - lib/rhoconnect/api/store/get_db_doc.rb
663
623
  - lib/rhoconnect/api_token.rb
664
624
  - lib/rhoconnect/generator.rb
665
625
  - lib/rhoconnect/ping/rhoconnect_push.rb
@@ -828,7 +788,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
828
788
  version: '0'
829
789
  segments:
830
790
  - 0
831
- hash: 3219845311812251669
791
+ hash: -420963856285787510
832
792
  required_rubygems_version: !ruby/object:Gem::Requirement
833
793
  none: false
834
794
  requirements:
@@ -1,3 +0,0 @@
1
- # Server.resource_api '', "/rc/#{Rhoconnect::API_VERSION}/app/ans_login", :get, {:login_required => false, :admin_route => false} do
2
- # do_ans_login
3
- # end
@@ -1,10 +0,0 @@
1
- # Server.resource_api '', "/rc/#{Rhoconnect::API_VERSION}/app/bulk_data", \
2
- # :post, {:login_required => true, :admin_route => false, :deprecated_route => {:verb => :get, :url => ['/application/bulk_data', '/api/application/bulk_data']}} do
3
- # content_type :json
4
- # sources_param = params[:sources]
5
- # if sources_param.is_a?String
6
- # sources_param = sources_param.split(',')
7
- # end
8
- # data = ClientSync.bulk_data(params[:partition].to_sym,current_client, sources_param)
9
- # data.to_json
10
- # end
@@ -1,11 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_id/fast_delete", :post, \
2
- # {:admin_route => true, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/api/fast_delete', '/api/source/fast_delete']}} do
3
- # source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
4
- # # if source does not exist create one for dynamic adapter
5
- # source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
6
- # source_sync = SourceSync.new(source)
7
- # timeout = params[:timeout] || 10
8
- # raise_on_expire = params[:raise_on_expire] || false
9
- # source_sync.fast_delete(params[:data], timeout,raise_on_expire)
10
- # 'done'
11
- # end
@@ -1,11 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_id/fast_insert", :post, \
2
- # {:admin_route => true, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/api/fast_insert', '/api/source/fast_insert']}} do
3
- # source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
4
- # # if source does not exist create one for dynamic adapter
5
- # source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
6
- # source_sync = SourceSync.new(source)
7
- # timeout = params[:timeout] || 10
8
- # raise_on_expire = params[:raise_on_expire] || false
9
- # source_sync.fast_insert(params[:data], timeout,raise_on_expire)
10
- # 'done'
11
- # end
@@ -1,11 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_id/fast_update", :post, \
2
- # {:admin_route => true, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/api/fast_update', '/api/source/fast_update']}} do
3
- # source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
4
- # # if source does not exist create one for dynamic adapter
5
- # source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
6
- # source_sync = SourceSync.new(source)
7
- # timeout = params[:timeout] || 10
8
- # raise_on_expire = params[:raise_on_expire] || false
9
- # source_sync.fast_update(params[:delete_data], params[:data],timeout,raise_on_expire)
10
- # 'done'
11
- # end
@@ -1,5 +0,0 @@
1
- # Server.resource_api '', "/rc/#{Rhoconnect::API_VERSION}/app/login", :post, \
2
- # {:admin_route => false, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/application/clientlogin', '/api/application/clientlogin']}} do
3
- # logout
4
- # do_login
5
- # end
@@ -1,12 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_id/push_deletes", :post, \
2
- # {:admin_route => true, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/api/push_deletes', '/api/source/push_deletes']}} do
3
- # source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
4
- # # if source does not exist create one for dynamic adapter
5
- # source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
6
- # source_sync = SourceSync.new(source)
7
- # timeout = params[:timeout] || 10
8
- # raise_on_expire = params[:raise_on_expire] || false
9
- # rebuild_md = params[:rebuild_md].nil? ? true : params[:rebuild_md]
10
- # source_sync.push_deletes(params[:objects],timeout,raise_on_expire,rebuild_md)
11
- # 'done'
12
- # end
@@ -1,12 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_id/push_objects", :post, \
2
- # {:admin_route => true, :login_required => false, :deprecated_route => {:verb => :post, :url => ['/api/push_objects', '/api/source/push_objects']}} do
3
- # source = Source.load(params[:source_id],{:app_id=>APP_NAME,:user_id=>params[:user_id]})
4
- # # if source does not exist create one for dynamic adapter
5
- # source = Source.create({:name => params[:source_id]},{:app_id => APP_NAME,:user_id=>params[:user_id]}) unless source
6
- # source_sync = SourceSync.new(source)
7
- # timeout = params[:timeout] || 10
8
- # raise_on_expire = params[:raise_on_expire] || false
9
- # rebuild_md = params[:rebuild_md].nil? ? true : params[:rebuild_md]
10
- # source_sync.push_objects(params[:objects],timeout,raise_on_expire,rebuild_md)
11
- # 'done'
12
- # end
@@ -1,8 +0,0 @@
1
- # Server.resource_api '', "/app/#{Rhoconnect::API_VERSION}/:source_name", :get, \
2
- # {:admin_route => false, :login_required => true, :deprecated_route => {:verb => :get, :url => ['/api/application', '/application', '/api/application/query']}} do
3
- # content_type :json
4
- # res = current_client_sync.send_cud(params[:token],params[:query])
5
- # response.headers[Rhoconnect::PAGE_TOKEN_HEADER] = res[1]['token']
6
- # response.headers[Rhoconnect::PAGE_OBJECT_COUNT_HEADER] = res[2]['count'].to_s
7
- # res.to_json
8
- # end
@@ -1,98 +0,0 @@
1
- # Server.api4 '', "/app/#{Rhoconnect::API_VERSION}/:source_name/queue_updates", :post, \
2
- # {:admin_route => false, :login_required => true, :deprecated_route => {:verb => :post, :url => ['/api/application', '/application', '/api/application/queue_updates']}} do
3
- # begin
4
- # if params["cud"]
5
- # cud = JSON.parse(params["cud"])
6
- # params.delete("cud")
7
- # params.merge!(cud)
8
- # end
9
- # rescue JSON::ParserError => jpe
10
- # log jpe.message + jpe.backtrace.join("\n")
11
- # throw :halt, [500, "Server error while processing client data"]
12
- # rescue Exception => e
13
- # log e.message + e.backtrace.join("\n")
14
- # throw :halt, [500, "Internal server error"]
15
- # end
16
- #
17
- # catch_all do
18
- # current_client_sync.receive_cud(params)
19
- # status 200
20
- # end
21
- # end
22
- #
23
- # Server.api4 '', "/app/#{Rhoconnect::API_VERSION}/:source_name", :post, \
24
- # {:login_required => true, :admin_route => false} do
25
- # begin
26
- # if params["cud"]
27
- # cud = JSON.parse(params["cud"])
28
- # params.delete("cud")
29
- # params.merge!(cud)
30
- # end
31
- # rescue JSON::ParserError => jpe
32
- # log jpe.message + jpe.backtrace.join("\n")
33
- # throw :halt, [500, "Server error while processing client data"]
34
- # rescue Exception => e
35
- # log e.message + e.backtrace.join("\n")
36
- # throw :halt, [500, "Internal server error"]
37
- # end
38
- #
39
- # catch_all do
40
- # current_client_sync.receive_cud(params)
41
- # status 200
42
- # end
43
- # end
44
- #
45
- # Server.api4 '', "/app/#{Rhoconnect::API_VERSION}/:source_name/:id", :put, \
46
- # {:login_required => true, :admin_route => false} do
47
- # begin
48
- # if params["cud"]
49
- # cud = JSON.parse(params["cud"])
50
- # params.delete("cud")
51
- # params.merge!(cud)
52
- # end
53
- # rescue JSON::ParserError => jpe
54
- # log jpe.message + jpe.backtrace.join("\n")
55
- # throw :halt, [500, "Server error while processing client data"]
56
- # rescue Exception => e
57
- # log e.message + e.backtrace.join("\n")
58
- # throw :halt, [500, "Internal server error"]
59
- # end
60
- #
61
- # begin
62
- # if params["update"]
63
- # cud = params["update"]
64
- # params.delete("update")
65
- # params.merge!("update" => {params[:id] => cud})
66
- # end
67
- # rescue JSON::ParserError => jpe
68
- # log jpe.message + jpe.backtrace.join("\n")
69
- # throw :halt, [500, "Server error while processing client data"]
70
- # rescue Exception => e
71
- # log e.message + e.backtrace.join("\n")
72
- # throw :halt, [500, "Internal server error"]
73
- # end
74
- #
75
- # catch_all do
76
- # current_client_sync.receive_cud(params)
77
- # status 200
78
- # end
79
- # end
80
- #
81
- # Server.api4 '', "/app/#{Rhoconnect::API_VERSION}/:source_name/:id", :delete, \
82
- # {:login_required => true, :admin_route => false} do
83
- # begin
84
- # obj = current_client.get_object(:cd, params[:id])
85
- # params.merge!("delete" => { params[:id] => obj } )
86
- # rescue JSON::ParserError => jpe
87
- # log jpe.message + jpe.backtrace.join("\n")
88
- # throw :halt, [500, "Server error while processing client data"]
89
- # rescue Exception => e
90
- # log e.message + e.backtrace.join("\n")
91
- # throw :halt, [500, "Internal server error"]
92
- # end
93
- #
94
- # catch_all do
95
- # current_client_sync.receive_cud(params)
96
- # status 200
97
- # end
98
- # end
@@ -1,8 +0,0 @@
1
- # Server.resource_api '', "/rc/#{Rhoconnect::API_VERSION}/app/search", :post, \
2
- # {:admin_route => false, :login_required => true, :deprecated_route => {:verb => :get, :url => ['/application/search', '/api/application/search']}} do
3
- # content_type :json
4
- # res = ClientSync.search_all(current_client,params)
5
- # response.headers[Rhoconnect::PAGE_TOKEN_HEADER] = res[0][1]['token'] if res[0][1] and res[0][1]['token']
6
- # response.headers[Rhoconnect::PAGE_OBJECT_COUNT_HEADER] = res[0][3]['count'].to_s if res[0][3] and res[0][3]['count']
7
- # res.to_json
8
- # end
@@ -1,5 +0,0 @@
1
- # Server.api4 :client_get_db_doc, :get, "/rc/#{Rhoconnect::API_VERSION}/clients/:client_id/sources/:source_id/docs/:doc", true, nil do |params,user|
2
- # c = Client.load(params[:client_id],{:source_name => params[:source_id]})
3
- # db_key = c.docname(params[:doc])
4
- # Store.get_db_doc(db_key)
5
- # end