resemble 0.0.0 → 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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/resemble.rb +234 -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: 7365fc49d26a265c8b7bbf7a9165ebbd1f71016f50029e26e245a9140b2a89f7
4
+ data.tar.gz: 4b754454539ca689c3e844538aca08762764db0e105f1ec0d92ed322c3f3f487
5
5
  SHA512:
6
- metadata.gz: a8946f189167d382c4915bcaffb7c1ad0cbea3d7ac16573aa1b21642c433bd9b708f75a36529ffe0f2f05896661682e2269faa80807cc4a33b9b57508caa96e7
7
- data.tar.gz: b73a69540ddfcfe5a89937e6be68b1464b76f964cce23e98fbe5e496b5b61a9991e521846a9cd1b7f97972f698ab8181d4f75e08f04ca64ad02ae861dbb5a5db
6
+ metadata.gz: 17bc20dfa4e28789eed1bd7db7e70012b21f3bd574080364a66ee0f0d749509d68d1e2b97f4d911b2a4510217d787c4366ce34464e8c6e85f694062e5ff8abbc
7
+ data.tar.gz: 9beeefd076d6199550f5dec9861913642bfade2d9c08e865cf0c39abb3b62fce694b1bf37820406c155c86ca5bcdf578c94c2fcce561f2c3beabb1b87a582f5d
data/lib/resemble.rb CHANGED
@@ -1,5 +1,235 @@
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)
86
+ options = {
87
+ body: {
88
+ name: name
89
+ }.to_json
90
+ }
91
+
92
+ Resemble.post(Resemble.endpoint('v2', 'voices'), options).parsed_response
93
+ end
94
+
95
+ def self.update(uuid, name)
96
+ options = {
97
+ body: {
98
+ name: name
99
+ }.to_json
100
+ }
101
+
102
+ Resemble.put(Resemble.endpoint('v2', "voices/#{uuid}"), options).parsed_response
103
+ end
104
+
105
+ def self.get(uuid)
106
+ Resemble.get(Resemble.endpoint('v2', "voices/#{uuid}")).parsed_response
107
+ end
108
+
109
+ def self.delete(uuid)
110
+ Resemble.delete(Resemble.endpoint('v2', "voices/#{uuid}")).parsed_response
111
+ end
112
+ end
113
+
114
+ module Recording
115
+ def self.all(voice_uuid, page, page_size = nil)
116
+ options = { query: { page: page } }
117
+ options[:query][:page_size] = page_size unless page_size.nil?
118
+
119
+ Resemble.get(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings"), options).parsed_response
120
+ end
121
+
122
+ def self.create(voice_uuid, file, name, text, is_active, emotion)
123
+ options = {
124
+ multipart: true,
125
+ body: {
126
+ file: file,
127
+ name: name,
128
+ text: text,
129
+ emotion: emotion,
130
+ is_active: is_active
131
+ }
132
+ }
133
+
134
+ Resemble.post(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings"), options).parsed_response
135
+ end
136
+
137
+ def self.update(voice_uuid, recording_uuid, name, text, is_active, emotion)
138
+ options = {
139
+ body: {
140
+ name: name,
141
+ text: text,
142
+ emotion: emotion,
143
+ is_active: is_active
144
+ }.to_json
145
+ }
146
+
147
+ Resemble.put(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}"), options).parsed_response
148
+ end
149
+
150
+ def self.get(voice_uuid, recording_uuid)
151
+ Resemble.get(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}")).parsed_response
152
+ end
153
+
154
+ def self.delete(voice_uuid, recording_uuid)
155
+ Resemble.delete(Resemble.endpoint('v2', "voices/#{voice_uuid}/recordings/#{recording_uuid}")).parsed_response
156
+ end
157
+ end
158
+
159
+ module Clip
160
+ def self.all(project_uuid, page, page_size = nil)
161
+ options = { query: { page: page } }
162
+ options[:query][:page_size] = page_size unless page_size.nil?
163
+
164
+ Resemble.get(Resemble.endpoint('v2', "projects/#{project_uuid}"), options).parsed_response
165
+ end
166
+
167
+ 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)
168
+ options = {
169
+ body: {
170
+ title: title,
171
+ body: body,
172
+ voice_uuid: voice_uuid,
173
+ is_public: is_public,
174
+ is_archived: is_archived,
175
+ sample_rate: sample_rate,
176
+ output_format: output_format,
177
+ precision: precision,
178
+ include_timestamps: include_timestamps,
179
+ raw: raw
180
+ }.compact.to_json
181
+ }
182
+
183
+ Resemble.post(Resemble.endpoint('v2', "projects/#{project_uuid}/clips"), options).parsed_response
184
+ end
185
+
186
+ 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)
187
+ options = {
188
+ body: {
189
+ title: title,
190
+ body: body,
191
+ voice_uuid: voice_uuid,
192
+ is_public: is_public,
193
+ is_archived: is_archived,
194
+ sample_rate: sample_rate,
195
+ output_format: output_format,
196
+ precision: precision,
197
+ include_timestamps: include_timestamps,
198
+ callback_uri: callback_uri
199
+ }.compact.to_json
200
+ }
201
+
202
+ Resemble.post(Resemble.endpoint('v2', "projects/#{project_uuid}/clips"), options).parsed_response
203
+ end
204
+
205
+ 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)
206
+ options = {
207
+ body: {
208
+ title: title,
209
+ body: body,
210
+ voice_uuid: voice_uuid,
211
+ is_public: is_public,
212
+ is_archived: is_archived,
213
+ sample_rate: sample_rate,
214
+ output_format: output_format,
215
+ precision: precision,
216
+ include_timestamps: include_timestamps,
217
+ callback_uri: callback_uri
218
+ }.compact.to_json
219
+ }
220
+
221
+ Resemble.put(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}"), options).parsed_response
222
+ end
223
+
224
+ def self.get(project_uuid, clip_uuid)
225
+ Resemble.get(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}")).parsed_response
226
+ end
227
+
228
+ def self.delete(project_uuid, clip_uuid)
229
+ Resemble.delete(Resemble.endpoint('v2', "projects/#{project_uuid}/clips/#{clip_uuid}")).parsed_response
230
+ end
231
+ end
232
+
233
+ end # V2 end
234
+
235
+ 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.0.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: 2021-09-23 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