assemblyai 1.0.0.pre.beta.7 → 1.0.0.pre.beta.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assemblyai/files/client.rb +4 -2
  3. data/lib/assemblyai/files/types/uploaded_file.rb +20 -11
  4. data/lib/assemblyai/lemur/client.rb +260 -150
  5. data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +28 -14
  6. data/lib/assemblyai/lemur/types/lemur_base_params.rb +83 -55
  7. data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +11 -5
  8. data/lib/assemblyai/lemur/types/lemur_base_response.rb +20 -11
  9. data/lib/assemblyai/lemur/types/lemur_question.rb +57 -32
  10. data/lib/assemblyai/lemur/types/lemur_question_answer.rb +28 -14
  11. data/lib/assemblyai/lemur/types/lemur_question_answer_response.rb +29 -15
  12. data/lib/assemblyai/lemur/types/lemur_question_context.rb +13 -6
  13. data/lib/assemblyai/lemur/types/lemur_summary_response.rb +28 -14
  14. data/lib/assemblyai/lemur/types/lemur_task_response.rb +28 -14
  15. data/lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb +32 -17
  16. data/lib/assemblyai/realtime/client.rb +30 -14
  17. data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +24 -13
  18. data/lib/assemblyai/realtime/types/final_transcript.rb +73 -42
  19. data/lib/assemblyai/realtime/types/force_end_utterance.rb +20 -11
  20. data/lib/assemblyai/realtime/types/message_type.rb +1 -0
  21. data/lib/assemblyai/realtime/types/partial_transcript.rb +63 -35
  22. data/lib/assemblyai/realtime/types/realtime_base_message.rb +22 -13
  23. data/lib/assemblyai/realtime/types/realtime_base_transcript.rb +57 -31
  24. data/lib/assemblyai/realtime/types/realtime_error.rb +20 -11
  25. data/lib/assemblyai/realtime/types/realtime_message.rb +44 -18
  26. data/lib/assemblyai/realtime/types/realtime_temporary_token_response.rb +20 -11
  27. data/lib/assemblyai/realtime/types/realtime_transcript.rb +15 -9
  28. data/lib/assemblyai/realtime/types/session_begins.rb +32 -15
  29. data/lib/assemblyai/realtime/types/session_information.rb +69 -0
  30. data/lib/assemblyai/realtime/types/session_terminated.rb +21 -12
  31. data/lib/assemblyai/realtime/types/terminate_session.rb +20 -11
  32. data/lib/assemblyai/realtime/types/word.rb +36 -18
  33. data/lib/assemblyai/streaming/types/receive_message.rb +113 -0
  34. data/lib/assemblyai/{realtime → streaming}/types/send_message.rb +26 -14
  35. data/lib/assemblyai/streaming/types/streaming.rb +11 -0
  36. data/lib/assemblyai/transcripts/client.rb +50 -18
  37. data/lib/assemblyai/transcripts/list_by_url_client.rb +6 -4
  38. data/lib/assemblyai/transcripts/polling_client.rb +12 -2
  39. data/lib/assemblyai/transcripts/types/auto_highlight_result.rb +40 -19
  40. data/lib/assemblyai/transcripts/types/auto_highlights_result.rb +38 -14
  41. data/lib/assemblyai/transcripts/types/chapter.rb +40 -20
  42. data/lib/assemblyai/transcripts/types/content_safety_label.rb +32 -16
  43. data/lib/assemblyai/transcripts/types/content_safety_label_result.rb +51 -29
  44. data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +51 -29
  45. data/lib/assemblyai/transcripts/types/entity.rb +41 -21
  46. data/lib/assemblyai/transcripts/types/entity_type.rb +15 -0
  47. data/lib/assemblyai/transcripts/types/page_details.rb +62 -36
  48. data/lib/assemblyai/transcripts/types/paragraphs_response.rb +37 -19
  49. data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +4 -1
  50. data/lib/assemblyai/transcripts/types/redacted_audio_response.rb +29 -15
  51. data/lib/assemblyai/transcripts/types/sentences_response.rb +37 -19
  52. data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +63 -36
  53. data/lib/assemblyai/transcripts/types/severity_score_summary.rb +32 -16
  54. data/lib/assemblyai/transcripts/types/speech_model.rb +1 -0
  55. data/lib/assemblyai/transcripts/types/substitution_policy.rb +3 -1
  56. data/lib/assemblyai/transcripts/types/timestamp.rb +28 -14
  57. data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +39 -20
  58. data/lib/assemblyai/transcripts/types/topic_detection_result.rb +40 -21
  59. data/lib/assemblyai/transcripts/types/topic_detection_result_labels_item.rb +31 -15
  60. data/lib/assemblyai/transcripts/types/transcript.rb +513 -295
  61. data/lib/assemblyai/transcripts/types/transcript_custom_spelling.rb +30 -15
  62. data/lib/assemblyai/transcripts/types/transcript_language_code.rb +87 -4
  63. data/lib/assemblyai/transcripts/types/transcript_list.rb +33 -17
  64. data/lib/assemblyai/transcripts/types/transcript_list_item.rb +60 -35
  65. data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +338 -196
  66. data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +61 -34
  67. data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +30 -16
  68. data/lib/assemblyai/transcripts/types/transcript_sentence.rb +61 -34
  69. data/lib/assemblyai/transcripts/types/transcript_status.rb +2 -1
  70. data/lib/assemblyai/transcripts/types/transcript_utterance.rb +55 -32
  71. data/lib/assemblyai/transcripts/types/transcript_word.rb +55 -24
  72. data/lib/assemblyai/transcripts/types/word_search_match.rb +40 -20
  73. data/lib/assemblyai/transcripts/types/word_search_response.rb +36 -17
  74. data/lib/assemblyai/types/error.rb +32 -16
  75. data/lib/requests.rb +80 -34
  76. data/lib/types_export.rb +4 -3
  77. metadata +6 -5
  78. data/lib/assemblyai/realtime/types/audio_data.rb +0 -7
  79. data/lib/assemblyai/realtime/types/receive_message.rb +0 -87
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76ddcd8ef7bd03dab334e872387e6ea6f01d1c93d26ec1a1ffc57a29ec498f1a
4
- data.tar.gz: 57abade0a92ef0dd0031f27098d9f7bdebfc17f7445776409af4b8627afe11a0
3
+ metadata.gz: 8966cf8fd4bf25ddc706a276125abd055e0d959ab9a9e08a244cf62e673f5117
4
+ data.tar.gz: 49482eed13d7dbdd01846510dcfad1e9c22a910a79bf96f50c01932bb858a821
5
5
  SHA512:
6
- metadata.gz: 17410d40ef0225953ff55910ad561334b7ef6a7cda2e9b190103885878c920b573abcffc9fddc904aefccf896e03629640e7884efde32e4df39e549e17847252
7
- data.tar.gz: 1c4739c4fee6647ac9edffd00a1a84c7bd7b6fa0064e5126097e6194372a967a976acfecee128a5c7a08738f9864044278247574c91ddb5b40b0903197f49cbd
6
+ metadata.gz: 01705c2608ea28815a847e01bffb4f7224e050e6b61dd3692b1f44d16eeabf2e6561e93356331709b32a2702c3c1c3a75864a1659a75d48a354739d832f0853f
7
+ data.tar.gz: 2789963c8e6e1f1b39013d0c398eaad39b8bd05dd13af4b80389bddf1337101465804360e6585ca29ab44ded1a9580bed610e3fcc8405537414a2557b12bf819
@@ -21,7 +21,7 @@ module AssemblyAI
21
21
  # @param request_options [RequestOptions]
22
22
  # @return [Files::UploadedFile]
23
23
  def upload(file:, request_options: nil)
24
- response = @request_client.conn.post("/v2/upload") do |req|
24
+ response = @request_client.conn.post do |req|
25
25
  if file.is_a? String
26
26
  begin
27
27
  path = Pathname.new(file)
@@ -50,6 +50,7 @@ module AssemblyAI
50
50
  req.headers["Transfer-Encoding"] = "chunked"
51
51
  end
52
52
  req.body = file_data
53
+ req.url "#{@request_client.get_url(request_options: request_options)}/v2/upload"
53
54
  end
54
55
  Files::UploadedFile.from_json(json_object: response.body)
55
56
  end
@@ -72,7 +73,7 @@ module AssemblyAI
72
73
  # @return [Files::UploadedFile]
73
74
  def upload(file:, request_options: nil)
74
75
  Async do
75
- response = @request_client.conn.post("/v2/upload") do |req|
76
+ response = @request_client.conn.post do |req|
76
77
  if file.is_a? String
77
78
  begin
78
79
  path = Pathname.new(file)
@@ -101,6 +102,7 @@ module AssemblyAI
101
102
  req.headers["Transfer-Encoding"] = "chunked"
102
103
  end
103
104
  req.body = file_data
105
+ req.url "#{@request_client.get_url(request_options: request_options)}/v2/upload"
104
106
  end
105
107
  Files::UploadedFile.from_json(json_object: response.body)
106
108
  end
@@ -1,41 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ostruct"
3
4
  require "json"
4
5
 
5
6
  module AssemblyAI
6
7
  class Files
7
8
  class UploadedFile
8
- attr_reader :upload_url, :additional_properties
9
+ # @return [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
10
+ attr_reader :upload_url
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
9
18
 
10
19
  # @param upload_url [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
11
20
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
12
- # @return [Files::UploadedFile]
21
+ # @return [AssemblyAI::Files::UploadedFile]
13
22
  def initialize(upload_url:, additional_properties: nil)
14
- # @type [String] A URL that points to your audio file, accessible only by AssemblyAI's servers
15
23
  @upload_url = upload_url
16
- # @type [OpenStruct] Additional properties unmapped to the current class definition
17
24
  @additional_properties = additional_properties
25
+ @_field_set = { "upload_url": upload_url }
18
26
  end
19
27
 
20
28
  # Deserialize a JSON object to an instance of UploadedFile
21
29
  #
22
- # @param json_object [JSON]
23
- # @return [Files::UploadedFile]
30
+ # @param json_object [String]
31
+ # @return [AssemblyAI::Files::UploadedFile]
24
32
  def self.from_json(json_object:)
25
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
26
- JSON.parse(json_object)
27
- upload_url = struct.upload_url
34
+ upload_url = struct["upload_url"]
28
35
  new(upload_url: upload_url, additional_properties: struct)
29
36
  end
30
37
 
31
38
  # Serialize an instance of UploadedFile to a JSON object
32
39
  #
33
- # @return [JSON]
40
+ # @return [String]
34
41
  def to_json(*_args)
35
- { "upload_url": @upload_url }.to_json
42
+ @_field_set&.to_json
36
43
  end
37
44
 
38
- # 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.
45
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
46
+ # hash and check each fields type against the current object's property
47
+ # definitions.
39
48
  #
40
49
  # @param obj [Object]
41
50
  # @return [Void]