Skip to content

Commit

Permalink
Merge pull request #28 from AssemblyAI/fern-bot/04-15-2024-0515PM
Browse files Browse the repository at this point in the history
🌿 Fern Regeneration -- April 15, 2024
  • Loading branch information
Swimburger committed Apr 15, 2024
2 parents 2922d05 + 18fcf17 commit 9723f39
Show file tree
Hide file tree
Showing 77 changed files with 3,530 additions and 1,885 deletions.
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ AllCops:
TargetRubyVersion: 2.7
NewCops: enable


Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Expand Down Expand Up @@ -53,4 +52,7 @@ Metrics/BlockLength:
Enabled: false

Gemspec/RequireMFA:
Enabled: false

Style/IfUnlessModifier:
Enabled: false
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require "rake/testtask"
require "rubocop/rake_task"

task default: %i[test rubocop]

Rake::TestTask.new do |t|
t.pattern = "./test/**/test_*.rb"
end

RuboCop::RakeTask.new
2 changes: 1 addition & 1 deletion assemblyai.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require_relative "lib/gemconfig"

Gem::Specification.new do |spec|
spec.name = "assemblyai"
spec.version = "1.0.0-beta.7"
spec.version = "1.0.0-beta.8"
spec.authors = AssemblyAI::Gemconfig::AUTHORS
spec.email = AssemblyAI::Gemconfig::EMAIL
spec.summary = AssemblyAI::Gemconfig::SUMMARY
Expand Down
6 changes: 4 additions & 2 deletions lib/assemblyai/files/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(request_client:)
# @param request_options [RequestOptions]
# @return [Files::UploadedFile]
def upload(file:, request_options: nil)
response = @request_client.conn.post("/v2/upload") do |req|
response = @request_client.conn.post do |req|
if file.is_a? String
begin
path = Pathname.new(file)
Expand Down Expand Up @@ -50,6 +50,7 @@ def upload(file:, request_options: nil)
req.headers["Transfer-Encoding"] = "chunked"
end
req.body = file_data
req.url "#{@request_client.get_url(request_options: request_options)}/v2/upload"
end
Files::UploadedFile.from_json(json_object: response.body)
end
Expand All @@ -72,7 +73,7 @@ def initialize(request_client:)
# @return [Files::UploadedFile]
def upload(file:, request_options: nil)
Async do
response = @request_client.conn.post("/v2/upload") do |req|
response = @request_client.conn.post do |req|
if file.is_a? String
begin
path = Pathname.new(file)
Expand Down Expand Up @@ -101,6 +102,7 @@ def upload(file:, request_options: nil)
req.headers["Transfer-Encoding"] = "chunked"
end
req.body = file_data
req.url "#{@request_client.get_url(request_options: request_options)}/v2/upload"
end
Files::UploadedFile.from_json(json_object: response.body)
end
Expand Down
31 changes: 20 additions & 11 deletions lib/assemblyai/files/types/uploaded_file.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
# frozen_string_literal: true

require "ostruct"
require "json"

module AssemblyAI
class Files
class UploadedFile
attr_reader :upload_url, :additional_properties
# @return [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
attr_reader :upload_url
# @return [OpenStruct] Additional properties unmapped to the current class definition
attr_reader :additional_properties
# @return [Object]
attr_reader :_field_set
protected :_field_set

OMIT = Object.new

# @param upload_url [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Files::UploadedFile]
# @return [AssemblyAI::Files::UploadedFile]
def initialize(upload_url:, additional_properties: nil)
# @type [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
@upload_url = upload_url
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
@_field_set = { "upload_url": upload_url }
end

# Deserialize a JSON object to an instance of UploadedFile
#
# @param json_object [JSON]
# @return [Files::UploadedFile]
# @param json_object [String]
# @return [AssemblyAI::Files::UploadedFile]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
JSON.parse(json_object)
upload_url = struct.upload_url
upload_url = struct["upload_url"]
new(upload_url: upload_url, additional_properties: struct)
end

# Serialize an instance of UploadedFile to a JSON object
#
# @return [JSON]
# @return [String]
def to_json(*_args)
{ "upload_url": @upload_url }.to_json
@_field_set&.to_json
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
# Leveraged for Union-type generation, validate_raw attempts to parse the given
# hash and check each fields type against the current object's property
# definitions.
#
# @param obj [Object]
# @return [Void]
Expand Down
Loading

0 comments on commit 9723f39

Please sign in to comment.