resemble 0.0.0 → 1.2.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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/resemble.rb +240 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10a149f1c8732f449051a4a692a4799cc214cb3edc36d14ede6ae05f2256428e
4
- data.tar.gz: cc5a96503721c0db4452860e89e128dbc8421d5cff807239fe6b7fbb94eb6169
3
+ metadata.gz: bcc8cb40a02aa2d7bf0241672165f4806e6a300bca937cf45e491af18f77f987
4
+ data.tar.gz: d0553edbf865af5da00c1b39750fbb1010ac62004e53befe975c086c6c72646d
5
5
  SHA512:
6
- metadata.gz: a8946f189167d382c4915bcaffb7c1ad0cbea3d7ac16573aa1b21642c433bd9b708f75a36529ffe0f2f05896661682e2269faa80807cc4a33b9b57508caa96e7
7
- data.tar.gz: b73a69540ddfcfe5a89937e6be68b1464b76f964cce23e98fbe5e496b5b61a9991e521846a9cd1b7f97972f698ab8181d4f75e08f04ca64ad02ae861dbb5a5db
6
+ metadata.gz: a786354c69e6508a8fac86ee464fdb33957c157ffc7ccf384e7626ed6aaca5debaf11ca18beea5c8dabe65800188e289f5680a6999fbb747c7dde10cefa114e5
7
+ data.tar.gz: c874694516c35daf9e728e09e8ba6db453bf4545aac1fc904079077689b5e0f009940ef9bb6bc390bf747a8d055dd8ba04127c7797e64f8f739182152a90eeca
data/lib/resemble.rb CHANGED
@@ -1,5 +1,241 @@
1
- class Resemble
2
- def self.hi
3
- puts "Hello!"
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+
5
+ module Resemble
6
+ include HTTParty
7
+ headers 'Content-Type' => 'application/json'
8
+
9
+ def self.api_key
10
+ @token || nil
4
11
  end
5
- end
12
+
13
+ def self.api_key=(api_key)
14
+ @token = api_key
15
+
16
+ headers 'Authorization' => "Token token=#{@token}"
17
+ end
18
+
19
+ def self.base_url
20
+ @base_url || 'https://app.resemble.ai/api/'
21
+ end
22
+
23
+ def self.base_url=(api_base_url)
24
+ @base_url = api_base_url
25
+ end
26
+
27
+ def self.endpoint(version, endpoint)
28
+ "#{Resemble.base_url}#{version}#{endpoint.start_with?('/') ? endpoint : "/#{endpoint}"}"
29
+ end
30
+
31
+ module V2
32
+ module Project
33
+ def self.all(page, page_size = nil)
34
+ options = { query: { page: page } }
35
+ options[:query][:page_size] = page_size unless page_size.nil?
36
+
37
+ Resemble.get(Resemble.endpoint('v2', 'projects'), options).parsed_response
38
+ end
39
+
40
+ def self.create(name, description, is_public, is_collaborative, is_archived)
41
+ options = {
42
+ body: {
43
+ name: name,
44
+ description: description,
45
+ is_public: is_public,
46
+ is_collaborative: is_collaborative,
47
+ is_archived: is_archived
48
+ }.to_json
49
+ }
50
+
51
+ Resemble.post(Resemble.endpoint('v2', 'projects'), options).parsed_response
52
+ end
53
+
54
+ def self.update(uuid, name, description, is_public, is_collaborative, is_archived)
55
+ options = {
56
+ body: {
57
+ name: name,
58
+ description: description,
59
+ is_public: is_public,
60
+ is_collaborative: is_collaborative,
61
+ is_archived: is_archived
62
+ }.to_json
63
+ }
64
+
65
+ Resemble.put(Resemble.endpoint('v2', "projects/#{uuid}"), options).parsed_response
66
+ end
67
+
68
+ def self.get(uuid)
69
+ Resemble.get(Resemble.endpoint('v2', "projects/#{uuid}")).parsed_response
70
+ end
71
+
72
+ def self.delete(uuid)
73
+ Resemble.delete(Resemble.endpoint('v2', "projects/#{uuid}")).parsed_response
74
+ end
75
+ end
76
+
77
+ module Voice
78
+ def self.all(page, page_size = nil)
79
+ options = { query: { page: page } }
80
+ options[:query][:page_size] = page_size unless page_size.nil?
81
+
82
+ Resemble.get(Resemble.endpoint('v2', 'voices'), options).parsed_response
83
+ end
84
+
85
+ def self.create(name, dataset_url = nil, callback_uri = nil)
86
+ options = {
87
+ body: {
88
+ name: name,
89
+ dataset_url: dataset_url,
90
+ callback_uri: callback_uri
91
+ }.compact.to_json
92
+ }
93
+
94
+ Resemble.post(Resemble.endpoint('v2', 'voices'), options).parsed_response
95
+ end
96
+
97
+ def self.update(uuid, name)
98
+ options = {
99
+ body: {
100
+ name: name
101
+ }.to_json
102
+ }
103
+
104
+ Resemble.put(Resemble.endpoint('v2', "voices/#{uuid}"), options).parsed_response
105
+ end
106
+
107
+ def self.build(uuid)
108
+ Resemble.post(Resemble.endpoint('v2', "voices/#{uuid}/build")).parsed_response
109
+ end
110
+
111
+ def self.get(uuid)
112
+ Resemble.get(Resemble.endpoint('v2', "voices/#{uuid}")).parsed_response
113
+ end
114
+
115
+ def self.delete(uuid)
116
+ Resemble.delete(Resemble.endpoint('v2', "voices/#{uuid}")).parsed_response
117
+ end
118
+ end
119
+
120
+ module Recording
121
+ def self.all(voice_uuid, page, page_size = nil)
122
+ options = { query: { page: page } }
123
+ options[:query][:page_size] = page_size unless page_size.nil?
124
+
125
+ Resemble.get(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings"), options).parsed_response
126
+ end
127
+
128
+ def self.create(voice_uuid, file, name, text, is_active, emotion)
129
+ options = {
130
+ multipart: true,
131
+ body: {
132
+ file: file,
133
+ name: name,
134
+ text: text,
135
+ emotion: emotion,
136
+ is_active: is_active
137
+ }
138
+ }
139
+
140
+ Resemble.post(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings"), options).parsed_response
141
+ end
142
+
143
+ def self.update(voice_uuid, recording_uuid, name, text, is_active, emotion)
144
+ options = {
145
+ body: {
146
+ name: name,
147
+ text: text,
148
+ emotion: emotion,
149
+ is_active: is_active
150
+ }.to_json
151
+ }
152
+
153
+ Resemble.put(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}"), options).parsed_response
154
+ end
155
+
156
+ def self.get(voice_uuid, recording_uuid)
157
+ Resemble.get(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}")).parsed_response
158
+ end
159
+
160
+ def self.delete(voice_uuid, recording_uuid)
161
+ Resemble.delete(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}")).parsed_response
162
+ end
163
+ end
164
+
165
+ module Clip
166
+ def self.all(project_uuid, page, page_size = nil)
167
+ options = { query: { page: page } }
168
+ options[:query][:page_size] = page_size unless page_size.nil?
169
+
170
+ Resemble.get(Resemble.endpoint('v2', "projects/#{project_uuid}"), options).parsed_response
171
+ end
172
+
173
+ def self.create_sync(project_uuid, voice_uuid, body, title: nil, sample_rate: nil, output_format: nil, precision: nil, include_timestamps: nil, is_public: nil, is_archived: nil, raw: nil)
174
+ options = {
175
+ body: {
176
+ title: title,
177
+ body: body,
178
+ voice_uuid: voice_uuid,
179
+ is_public: is_public,
180
+ is_archived: is_archived,
181
+ sample_rate: sample_rate,
182
+ output_format: output_format,
183
+ precision: precision,
184
+ include_timestamps: include_timestamps,
185
+ raw: raw
186
+ }.compact.to_json
187
+ }
188
+
189
+ Resemble.post(Resemble.endpoint('v2', "projects/#{project_uuid}/clips"), options).parsed_response
190
+ end
191
+
192
+ def self.create_async(project_uuid, voice_uuid, callback_uri, body, title: nil, sample_rate: nil, output_format: nil, precision: nil, include_timestamps: nil, is_public: nil, is_archived: nil)
193
+ options = {
194
+ body: {
195
+ title: title,
196
+ body: body,
197
+ voice_uuid: voice_uuid,
198
+ is_public: is_public,
199
+ is_archived: is_archived,
200
+ sample_rate: sample_rate,
201
+ output_format: output_format,
202
+ precision: precision,
203
+ include_timestamps: include_timestamps,
204
+ callback_uri: callback_uri
205
+ }.compact.to_json
206
+ }
207
+
208
+ Resemble.post(Resemble.endpoint('v2', "projects/#{project_uuid}/clips"), options).parsed_response
209
+ end
210
+
211
+ def self.update_async(project_uuid, clip_uuid, voice_uuid, callback_uri, body, title: nil, sample_rate: nil, output_format: nil, precision: nil, include_timestamps: nil, is_public: nil, is_archived: nil)
212
+ options = {
213
+ body: {
214
+ title: title,
215
+ body: body,
216
+ voice_uuid: voice_uuid,
217
+ is_public: is_public,
218
+ is_archived: is_archived,
219
+ sample_rate: sample_rate,
220
+ output_format: output_format,
221
+ precision: precision,
222
+ include_timestamps: include_timestamps,
223
+ callback_uri: callback_uri
224
+ }.compact.to_json
225
+ }
226
+
227
+ Resemble.put(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}"), options).parsed_response
228
+ end
229
+
230
+ def self.get(project_uuid, clip_uuid)
231
+ Resemble.get(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}")).parsed_response
232
+ end
233
+
234
+ def self.delete(project_uuid, clip_uuid)
235
+ Resemble.delete(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}")).parsed_response
236
+ end
237
+ end
238
+
239
+ end # V2 end
240
+
241
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resemble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ResembleAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-06 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Resemble is the easiest way to clone and synthesize natural voice.
14
14
  email: team@resemble.ai
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
- rubygems_version: 3.2.3
39
+ rubygems_version: 3.2.15
40
40
  signing_key:
41
41
  specification_version: 4
42
42
  summary: Resemble API Client Library