call-recorder-api 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.bundle/config +3 -0
  3. data/.gitignore +3 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +12 -0
  6. data/README.md +15 -0
  7. data/bin/bundle +114 -0
  8. data/bin/htmldiff +29 -0
  9. data/bin/ldiff +29 -0
  10. data/bin/restclient +29 -0
  11. data/bin/rspec +29 -0
  12. data/lib/call_recorder_api/client.rb +464 -0
  13. data/lib/call_recorder_api/client/configuration.rb +13 -0
  14. data/lib/call_recorder_api/model.rb +79 -0
  15. data/lib/call_recorder_api/model/app.rb +19 -0
  16. data/lib/call_recorder_api/model/buy_credits_request.rb +39 -0
  17. data/lib/call_recorder_api/model/buy_credits_response.rb +27 -0
  18. data/lib/call_recorder_api/model/clone_file_request.rb +27 -0
  19. data/lib/call_recorder_api/model/clone_file_response.rb +35 -0
  20. data/lib/call_recorder_api/model/create_file_data.rb +59 -0
  21. data/lib/call_recorder_api/model/create_file_request.rb +31 -0
  22. data/lib/call_recorder_api/model/create_file_response.rb +31 -0
  23. data/lib/call_recorder_api/model/create_folder_request.rb +31 -0
  24. data/lib/call_recorder_api/model/create_folder_response.rb +35 -0
  25. data/lib/call_recorder_api/model/delete_files_request.rb +31 -0
  26. data/lib/call_recorder_api/model/delete_files_response.rb +27 -0
  27. data/lib/call_recorder_api/model/delete_folder_request.rb +31 -0
  28. data/lib/call_recorder_api/model/delete_folder_response.rb +27 -0
  29. data/lib/call_recorder_api/model/delete_meta_files_request.rb +31 -0
  30. data/lib/call_recorder_api/model/delete_meta_files_response.rb +27 -0
  31. data/lib/call_recorder_api/model/device_type.rb +19 -0
  32. data/lib/call_recorder_api/model/files_permission.rb +19 -0
  33. data/lib/call_recorder_api/model/get_files_request.rb +55 -0
  34. data/lib/call_recorder_api/model/get_files_response.rb +35 -0
  35. data/lib/call_recorder_api/model/get_files_response_file.rb +83 -0
  36. data/lib/call_recorder_api/model/get_folders_request.rb +23 -0
  37. data/lib/call_recorder_api/model/get_folders_response.rb +31 -0
  38. data/lib/call_recorder_api/model/get_folders_response_folder.rb +43 -0
  39. data/lib/call_recorder_api/model/get_languages_request.rb +23 -0
  40. data/lib/call_recorder_api/model/get_languages_response.rb +31 -0
  41. data/lib/call_recorder_api/model/get_messages_request.rb +23 -0
  42. data/lib/call_recorder_api/model/get_messages_response.rb +27 -0
  43. data/lib/call_recorder_api/model/get_messages_response_msg.rb +35 -0
  44. data/lib/call_recorder_api/model/get_meta_files_request.rb +27 -0
  45. data/lib/call_recorder_api/model/get_meta_files_response.rb +27 -0
  46. data/lib/call_recorder_api/model/get_meta_files_response_meta_files.rb +43 -0
  47. data/lib/call_recorder_api/model/get_phones_request.rb +23 -0
  48. data/lib/call_recorder_api/model/get_phones_response.rb +19 -0
  49. data/lib/call_recorder_api/model/get_phones_response_phone.rb +47 -0
  50. data/lib/call_recorder_api/model/get_profile_request.rb +23 -0
  51. data/lib/call_recorder_api/model/get_profile_response.rb +51 -0
  52. data/lib/call_recorder_api/model/get_profile_response_profile.rb +67 -0
  53. data/lib/call_recorder_api/model/get_settings_request.rb +23 -0
  54. data/lib/call_recorder_api/model/get_settings_response.rb +35 -0
  55. data/lib/call_recorder_api/model/get_settings_response_settings.rb +27 -0
  56. data/lib/call_recorder_api/model/get_translations_request.rb +27 -0
  57. data/lib/call_recorder_api/model/get_translations_response.rb +35 -0
  58. data/lib/call_recorder_api/model/language.rb +31 -0
  59. data/lib/call_recorder_api/model/notify_user_request.rb +35 -0
  60. data/lib/call_recorder_api/model/notify_user_response.rb +27 -0
  61. data/lib/call_recorder_api/model/play_beep.rb +19 -0
  62. data/lib/call_recorder_api/model/recover_file_request.rb +31 -0
  63. data/lib/call_recorder_api/model/recover_file_response.rb +31 -0
  64. data/lib/call_recorder_api/model/register_phone_request.rb +27 -0
  65. data/lib/call_recorder_api/model/register_phone_response.rb +35 -0
  66. data/lib/call_recorder_api/model/update_device_token_request.rb +31 -0
  67. data/lib/call_recorder_api/model/update_device_token_response.rb +27 -0
  68. data/lib/call_recorder_api/model/update_file_request.rb +67 -0
  69. data/lib/call_recorder_api/model/update_file_response.rb +27 -0
  70. data/lib/call_recorder_api/model/update_folder_request.rb +39 -0
  71. data/lib/call_recorder_api/model/update_folder_response.rb +31 -0
  72. data/lib/call_recorder_api/model/update_order_request.rb +27 -0
  73. data/lib/call_recorder_api/model/update_order_request_folder.rb +27 -0
  74. data/lib/call_recorder_api/model/update_order_response.rb +31 -0
  75. data/lib/call_recorder_api/model/update_profile_img_request.rb +27 -0
  76. data/lib/call_recorder_api/model/update_profile_img_response.rb +39 -0
  77. data/lib/call_recorder_api/model/update_profile_request.rb +27 -0
  78. data/lib/call_recorder_api/model/update_profile_request_data.rb +39 -0
  79. data/lib/call_recorder_api/model/update_profile_response.rb +31 -0
  80. data/lib/call_recorder_api/model/update_settings_request.rb +31 -0
  81. data/lib/call_recorder_api/model/update_settings_response.rb +31 -0
  82. data/lib/call_recorder_api/model/update_star_request.rb +35 -0
  83. data/lib/call_recorder_api/model/update_star_response.rb +31 -0
  84. data/lib/call_recorder_api/model/update_user_request.rb +31 -0
  85. data/lib/call_recorder_api/model/update_user_response.rb +31 -0
  86. data/lib/call_recorder_api/model/upload_meta_file_request.rb +39 -0
  87. data/lib/call_recorder_api/model/upload_meta_file_response.rb +35 -0
  88. data/lib/call_recorder_api/model/verify_folder_pass_request.rb +31 -0
  89. data/lib/call_recorder_api/model/verify_folder_pass_response.rb +31 -0
  90. data/lib/call_recorder_api/model/verify_phone_request.rb +55 -0
  91. data/lib/call_recorder_api/model/verify_phone_response.rb +35 -0
  92. data/spec/call_recorder_api/client_spec.rb +814 -0
  93. data/spec/resources/audio.mp3 +0 -0
  94. data/spec/resources/java.png +0 -0
  95. data/sync.sh +16 -0
  96. data/tmp.rb +23 -0
  97. metadata +136 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ee0b8f1c05aad9adc2ea9a705e01185d7268e61a5460e2b6f47c42f79a066709
4
+ data.tar.gz: 6be620f9ab91b1998b7d85c50fc80510b6cc3cc83d996030cfd018c307db7d5d
5
+ SHA512:
6
+ metadata.gz: a898fbc16ca8226d3fc0777f809095df876042b17f3b19d948c2e15a9dfe7bb67679d51645f5200b7980ffc1bc6b7d14a63573267c0d4f6d6b51611a6a25f2f9
7
+ data.tar.gz: 125117fa378348e656a2f07358131c549a09645f61b05973ffb06aa8a9d38a741ee4a071d2e3278f0fe196a9c4fb7d08c95075cd54e2fec590aab55ac82809af
data/.bundle/config ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ BUNDLE_PATH: "vendor/bundle"
3
+ BUNDLE_BIN: "bin"
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ vendor/
2
+ Gemfile.lock
3
+
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.0
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ ruby "2.7.0"
6
+
7
+ git_source(:github) {|repo_name| "https://bitbucket.org/novokrest/ruby-call-recorder-api" }
8
+
9
+ gem "json"
10
+ gem "rest-client"
11
+ gem "rspec", :require => 'spec'
12
+
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # ruby-call-recorder-api
2
+
3
+ rbenv init
4
+ rbenv local #ensure 2.7.0
5
+ bundle install
6
+ bundle exec ruby test
7
+
8
+ bundle install --binstubs
9
+ bin/rspec spec --tag '~skip'
10
+
11
+ special test:
12
+ ./bin/rspec spec/call_recorder_api/client_spec.rb:8
13
+
14
+ gem build call-recorder-api.gemspec
15
+
data/bin/bundle ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
data/bin/htmldiff ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'htmldiff' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/ldiff ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'ldiff' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("diff-lcs", "ldiff")
data/bin/restclient ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'restclient' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rest-client", "restclient")
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,464 @@
1
+ require 'call_recorder_api/client/configuration'
2
+ require 'call_recorder_api/model'
3
+ require 'rest-client'
4
+ require 'json'
5
+
6
+ module CallRecorderApi
7
+ class Client
8
+ def initialize(config = Configuration.new)
9
+ @config = config
10
+ end
11
+
12
+ def buy_credits(request)
13
+ r = RestClient.post(@config.baseUrl + '/rapi/buy_credits', {
14
+ 'amount': request.amount,
15
+ 'api_key': request.api_key,
16
+ 'device_type': request.device_type,
17
+ 'product_id': request.product_id,
18
+ 'receipt': request.receipt,
19
+ })
20
+ json = JSON.parse(r)
21
+ BuyCreditsResponse.new(
22
+ status = json['status'],
23
+ msg = json['msg'],
24
+ )
25
+ end
26
+
27
+ def clone_file(request)
28
+ r = RestClient.post(@config.baseUrl + '/rapi/clone_file', {
29
+ 'api_key': request.api_key,
30
+ 'id': request.id,
31
+ })
32
+ json = JSON.parse(r)
33
+ CloneFileResponse.new(
34
+ status = json['status'],
35
+ msg = json['msg'],
36
+ code = json['code'],
37
+ id = json['id'],
38
+ )
39
+ end
40
+
41
+ def create_file(request)
42
+ r = RestClient.post(@config.baseUrl + '/rapi/create_file', {
43
+ 'api_key': request.api_key,
44
+ 'data': request.data.to_json,
45
+ 'file': File.new(request.file, 'rb'),
46
+ })
47
+ json = JSON.parse(r)
48
+ CreateFileResponse.new(
49
+ status = json['status'],
50
+ id = json['id'],
51
+ msg = json['msg'],
52
+ )
53
+ end
54
+
55
+ def create_folder(request)
56
+ r = RestClient.post(@config.baseUrl + '/rapi/create_folder', {
57
+ 'api_key': request.api_key,
58
+ 'name': request.name,
59
+ 'pass': request.pass,
60
+ })
61
+ json = JSON.parse(r)
62
+ CreateFolderResponse.new(
63
+ status = json['status'],
64
+ msg = json['msg'],
65
+ id = json['id'],
66
+ code = json['code'],
67
+ )
68
+ end
69
+
70
+ def delete_files(request)
71
+ r = RestClient.post(@config.baseUrl + '/rapi/delete_files', {
72
+ 'action': request.action,
73
+ 'api_key': request.api_key,
74
+ 'ids': request.ids.join(','),
75
+ })
76
+ json = JSON.parse(r)
77
+ DeleteFilesResponse.new(
78
+ status = json['status'],
79
+ msg = json['msg'],
80
+ )
81
+ end
82
+
83
+ def delete_folder(request)
84
+ r = RestClient.post(@config.baseUrl + '/rapi/delete_folder', {
85
+ 'api_key': request.api_key,
86
+ 'id': request.id,
87
+ 'move_to': request.move_to,
88
+ })
89
+ json = JSON.parse(r)
90
+ DeleteFolderResponse.new(
91
+ status = json['status'],
92
+ msg = json['msg'],
93
+ )
94
+ end
95
+
96
+ def delete_meta_files(request)
97
+ r = RestClient.post(@config.baseUrl + '/rapi/delete_meta_files', {
98
+ 'api_key': request.api_key,
99
+ 'ids': request.ids.join(','),
100
+ 'parent_id': request.parent_id,
101
+ })
102
+ json = JSON.parse(r)
103
+ DeleteMetaFilesResponse.new(
104
+ status = json['status'],
105
+ msg = json['msg'],
106
+ )
107
+ end
108
+
109
+ def get_files(request)
110
+ r = RestClient.post(@config.baseUrl + '/rapi/get_files', {
111
+ 'api_key': request.api_key,
112
+ 'folder_id': request.folder_id,
113
+ 'id': request.id,
114
+ 'op': request.op,
115
+ 'page': request.page,
116
+ 'pass': request.pass,
117
+ 'q': request.q,
118
+ 'reminder': request.reminder,
119
+ 'source': request.source,
120
+ })
121
+ json = JSON.parse(r)
122
+ GetFilesResponse.new(
123
+ status = json['status'],
124
+ credits = json['credits'],
125
+ credits_trans = json['credits_trans'],
126
+ files = json['files'],
127
+ )
128
+ end
129
+
130
+ def get_folders(request)
131
+ r = RestClient.post(@config.baseUrl + '/rapi/get_folders', {
132
+ 'api_key': request.api_key,
133
+ })
134
+ json = JSON.parse(r)
135
+ GetFoldersResponse.new(
136
+ status = json['status'],
137
+ msg = json['msg'],
138
+ folders = json['folders'],
139
+ )
140
+ end
141
+
142
+ def get_languages(request)
143
+ r = RestClient.post(@config.baseUrl + '/rapi/get_languages', {
144
+ 'api_key': request.api_key,
145
+ })
146
+ json = JSON.parse(r)
147
+ GetLanguagesResponse.new(
148
+ status = json['status'],
149
+ msg = json['msg'],
150
+ languages = json['languages'],
151
+ )
152
+ end
153
+
154
+ def get_meta_files(request)
155
+ r = RestClient.post(@config.baseUrl + '/rapi/get_meta_files', {
156
+ 'api_key': request.api_key,
157
+ 'parent_id': request.parent_id,
158
+ })
159
+ json = JSON.parse(r)
160
+ GetMetaFilesResponse.new(
161
+ status = json['status'],
162
+ meta_files = json['meta_files'],
163
+ )
164
+ end
165
+
166
+ def get_msgs(request)
167
+ r = RestClient.post(@config.baseUrl + '/rapi/get_msgs', {
168
+ 'api_key': request.api_key,
169
+ })
170
+ json = JSON.parse(r)
171
+ GetMessagesResponse.new(
172
+ status = json['status'],
173
+ msgs = json['msgs'],
174
+ )
175
+ end
176
+
177
+ def get_phones(request)
178
+ r = RestClient.post(@config.baseUrl + '/rapi/get_phones', {
179
+ 'api_key': request.api_key,
180
+ })
181
+ json = JSON.parse(r)
182
+ GetPhonesResponse.new(
183
+ )
184
+ end
185
+
186
+ def get_profile(request)
187
+ r = RestClient.post(@config.baseUrl + '/rapi/get_profile', {
188
+ 'api_key': request.api_key,
189
+ })
190
+ json = JSON.parse(r)
191
+ GetProfileResponse.new(
192
+ status = json['status'],
193
+ code = json['code'],
194
+ profile = json['profile'],
195
+ app = json['app'],
196
+ share_url = json['share_url'],
197
+ rate_url = json['rate_url'],
198
+ credits = json['credits'],
199
+ credits_trans = json['credits_trans'],
200
+ )
201
+ end
202
+
203
+ def get_settings(request)
204
+ r = RestClient.post(@config.baseUrl + '/rapi/get_settings', {
205
+ 'api_key': request.api_key,
206
+ })
207
+ json = JSON.parse(r)
208
+ GetSettingsResponse.new(
209
+ status = json['status'],
210
+ app = json['app'],
211
+ credits = json['credits'],
212
+ settings = json['settings'],
213
+ )
214
+ end
215
+
216
+ def get_translations(request)
217
+ r = RestClient.post(@config.baseUrl + '/rapi/get_translations', {
218
+ 'api_key': request.api_key,
219
+ 'language': request.language,
220
+ })
221
+ json = JSON.parse(r)
222
+ GetTranslationsResponse.new(
223
+ status = json['status'],
224
+ msg = json['msg'],
225
+ code = json['code'],
226
+ translation = json['translation'],
227
+ )
228
+ end
229
+
230
+ def notify_user_custom(request)
231
+ r = RestClient.post(@config.baseUrl + '/rapi/notify_user_custom', {
232
+ 'api_key': request.api_key,
233
+ 'body': request.body,
234
+ 'device_type': request.device_type,
235
+ 'title': request.title,
236
+ })
237
+ json = JSON.parse(r)
238
+ NotifyUserResponse.new(
239
+ status = json['status'],
240
+ msg = json['msg'],
241
+ )
242
+ end
243
+
244
+ def recover_file(request)
245
+ r = RestClient.post(@config.baseUrl + '/rapi/recover_file', {
246
+ 'api_key': request.api_key,
247
+ 'folder_id': request.folder_id,
248
+ 'id': request.id,
249
+ })
250
+ json = JSON.parse(r)
251
+ RecoverFileResponse.new(
252
+ status = json['status'],
253
+ msg = json['msg'],
254
+ code = json['code'],
255
+ )
256
+ end
257
+
258
+ def register_phone(request)
259
+ r = RestClient.post(@config.baseUrl + '/rapi/register_phone', {
260
+ 'phone': request.phone,
261
+ 'token': request.token,
262
+ })
263
+ json = JSON.parse(r)
264
+ RegisterPhoneResponse.new(
265
+ status = json['status'],
266
+ phone = json['phone'],
267
+ code = json['code'],
268
+ msg = json['msg'],
269
+ )
270
+ end
271
+
272
+ def update_device_token(request)
273
+ r = RestClient.post(@config.baseUrl + '/rapi/update_device_token', {
274
+ 'api_key': request.api_key,
275
+ 'device_token': request.device_token,
276
+ 'device_type': request.device_type,
277
+ })
278
+ json = JSON.parse(r)
279
+ UpdateDeviceTokenResponse.new(
280
+ status = json['status'],
281
+ msg = json['msg'],
282
+ )
283
+ end
284
+
285
+ def update_file(request)
286
+ r = RestClient.post(@config.baseUrl + '/rapi/update_file', {
287
+ 'api_key': request.api_key,
288
+ 'email': request.email,
289
+ 'f_name': request.f_name,
290
+ 'folder_id': request.folder_id,
291
+ 'id': request.id,
292
+ 'l_name': request.l_name,
293
+ 'name': request.name,
294
+ 'notes': request.notes,
295
+ 'phone': request.phone,
296
+ 'remind_date': request.remind_date,
297
+ 'remind_days': request.remind_days,
298
+ 'tags': request.tags,
299
+ })
300
+ json = JSON.parse(r)
301
+ UpdateFileResponse.new(
302
+ status = json['status'],
303
+ msg = json['msg'],
304
+ )
305
+ end
306
+
307
+ def update_folder(request)
308
+ r = RestClient.post(@config.baseUrl + '/rapi/update_folder', {
309
+ 'api_key': request.api_key,
310
+ 'id': request.id,
311
+ 'is_private': request.is_private,
312
+ 'name': request.name,
313
+ 'pass': request.pass,
314
+ })
315
+ json = JSON.parse(r)
316
+ UpdateFolderResponse.new(
317
+ status = json['status'],
318
+ msg = json['msg'],
319
+ code = json['code'],
320
+ )
321
+ end
322
+
323
+ def update_order(request)
324
+ r = RestClient.post(@config.baseUrl + '/rapi/update_order', {
325
+ 'api_key': request.api_key,
326
+ 'folders': request.folders.join(','),
327
+ })
328
+ json = JSON.parse(r)
329
+ UpdateOrderResponse.new(
330
+ status = json['status'],
331
+ msg = json['msg'],
332
+ code = json['code'],
333
+ )
334
+ end
335
+
336
+ def update_profile_img(request)
337
+ r = RestClient.post(@config.baseUrl + '/upload/update_profile_img', {
338
+ 'api_key': request.api_key,
339
+ 'file': File.new(request.file, 'rb'),
340
+ })
341
+ json = JSON.parse(r)
342
+ UpdateProfileImgResponse.new(
343
+ status = json['status'],
344
+ msg = json['msg'],
345
+ code = json['code'],
346
+ file = json['file'],
347
+ path = json['path'],
348
+ )
349
+ end
350
+
351
+ def update_profile(request)
352
+ r = RestClient.post(@config.baseUrl + '/rapi/update_profile', {
353
+ 'api_key': request.api_key,
354
+ 'data[f_name]': request.data.f_name,
355
+ 'data[l_name]': request.data.l_name,
356
+ 'data[email]': request.data.email,
357
+ 'data[is_public]': request.data.is_public,
358
+ 'data[language]': request.data.language,
359
+ })
360
+ json = JSON.parse(r)
361
+ UpdateProfileResponse.new(
362
+ status = json['status'],
363
+ msg = json['msg'],
364
+ code = json['code'],
365
+ )
366
+ end
367
+
368
+ def update_settings(request)
369
+ r = RestClient.post(@config.baseUrl + '/rapi/update_settings', {
370
+ 'api_key': request.api_key,
371
+ 'files_permission': request.files_permission,
372
+ 'play_beep': request.play_beep,
373
+ })
374
+ json = JSON.parse(r)
375
+ UpdateSettingsResponse.new(
376
+ status = json['status'],
377
+ msg = json['msg'],
378
+ code = json['code'],
379
+ )
380
+ end
381
+
382
+ def update_star(request)
383
+ r = RestClient.post(@config.baseUrl + '/rapi/update_star', {
384
+ 'api_key': request.api_key,
385
+ 'id': request.id,
386
+ 'star': request.star,
387
+ 'type': request.type,
388
+ })
389
+ json = JSON.parse(r)
390
+ UpdateStarResponse.new(
391
+ status = json['status'],
392
+ msg = json['msg'],
393
+ code = json['code'],
394
+ )
395
+ end
396
+
397
+ def update_user(request)
398
+ r = RestClient.post(@config.baseUrl + '/rapi/update_user', {
399
+ 'api_key': request.api_key,
400
+ 'app': request.app,
401
+ 'time_zone': request.time_zone,
402
+ })
403
+ json = JSON.parse(r)
404
+ UpdateUserResponse.new(
405
+ status = json['status'],
406
+ msg = json['msg'],
407
+ code = json['code'],
408
+ )
409
+ end
410
+
411
+ def upload_meta_file(request)
412
+ r = RestClient.post(@config.baseUrl + '/rapi/upload_meta_file', {
413
+ 'api_key': request.api_key,
414
+ 'file': File.new(request.file, 'rb'),
415
+ 'id': request.id,
416
+ 'name': request.name,
417
+ 'parent_id': request.parent_id,
418
+ })
419
+ json = JSON.parse(r)
420
+ UploadMetaFileResponse.new(
421
+ status = json['status'],
422
+ msg = json['msg'],
423
+ parent_id = json['parent_id'],
424
+ id = json['id'],
425
+ )
426
+ end
427
+
428
+ def verify_folder_pass(request)
429
+ r = RestClient.post(@config.baseUrl + '/rapi/verify_folder_pass', {
430
+ 'api_key': request.api_key,
431
+ 'id': request.id,
432
+ 'pass': request.pass,
433
+ })
434
+ json = JSON.parse(r)
435
+ VerifyFolderPassResponse.new(
436
+ status = json['status'],
437
+ msg = json['msg'],
438
+ code = json['code'],
439
+ )
440
+ end
441
+
442
+ def verify_phone(request)
443
+ r = RestClient.post(@config.baseUrl + '/rapi/verify_phone', {
444
+ 'app': request.app,
445
+ 'code': request.code,
446
+ 'device_id': request.device_id,
447
+ 'device_token': request.device_token,
448
+ 'device_type': request.device_type,
449
+ 'mcc': request.mcc,
450
+ 'phone': request.phone,
451
+ 'time_zone': request.time_zone,
452
+ 'token': request.token,
453
+ })
454
+ json = JSON.parse(r)
455
+ VerifyPhoneResponse.new(
456
+ status = json['status'],
457
+ phone = json['phone'],
458
+ api_key = json['api_key'],
459
+ msg = json['msg'],
460
+ )
461
+ end
462
+
463
+ end
464
+ end