Class: AssemblyAI::Transcripts::PageDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/assemblyai/transcripts/types/page_details.rb

Overview

Details of the transcript page. Transcripts are sorted from newest to oldest.

The previous URL always points to a page with older transcripts.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit:, result_count:, current_url:, prev_url: OMIT, next_url: OMIT, additional_properties: nil) ⇒ AssemblyAI::Transcripts::PageDetails

Parameters:

  • limit (Integer)

    The number of results this page is limited to

  • result_count (Integer)

    The actual number of results in the page

  • current_url (String)

    The URL used to retrieve the current page of transcripts

  • prev_url (String) (defaults to: OMIT)

    The URL to the next page of transcripts. The previous URL always points to a page with older transcripts.

  • next_url (String) (defaults to: OMIT)

    The URL to the next page of transcripts. The next URL always points to a page with newer transcripts.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 40

def initialize(limit:, result_count:, current_url:, prev_url: OMIT, next_url: OMIT, additional_properties: nil)
  @limit = limit
  @result_count = result_count
  @current_url = current_url
  @prev_url = prev_url if prev_url != OMIT
  @next_url = next_url if next_url != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "limit": limit,
    "result_count": result_count,
    "current_url": current_url,
    "prev_url": prev_url,
    "next_url": next_url
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



24
25
26
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 24

def additional_properties
  @additional_properties
end

#current_urlString (readonly)

Returns The URL used to retrieve the current page of transcripts.

Returns:

  • (String)

    The URL used to retrieve the current page of transcripts



16
17
18
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 16

def current_url
  @current_url
end

#limitInteger (readonly)

Returns The number of results this page is limited to.

Returns:

  • (Integer)

    The number of results this page is limited to



12
13
14
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 12

def limit
  @limit
end

#next_urlString (readonly)

Returns The URL to the next page of transcripts. The next URL always points to a page with newer transcripts.

Returns:

  • (String)

    The URL to the next page of transcripts. The next URL always points to a page with newer transcripts.



22
23
24
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 22

def next_url
  @next_url
end

#prev_urlString (readonly)

Returns The URL to the next page of transcripts. The previous URL always points to a page with older transcripts.

Returns:

  • (String)

    The URL to the next page of transcripts. The previous URL always points to a page with older transcripts.



19
20
21
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 19

def prev_url
  @prev_url
end

#result_countInteger (readonly)

Returns The actual number of results in the page.

Returns:

  • (Integer)

    The actual number of results in the page



14
15
16
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 14

def result_count
  @result_count
end

Class Method Details

.from_json(json_object:) ⇒ AssemblyAI::Transcripts::PageDetails

Deserialize a JSON object to an instance of PageDetails

Parameters:

  • json_object (String)

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 62

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  limit = struct["limit"]
  result_count = struct["result_count"]
  current_url = struct["current_url"]
  prev_url = struct["prev_url"]
  next_url = struct["next_url"]
  new(
    limit: limit,
    result_count: result_count,
    current_url: current_url,
    prev_url: prev_url,
    next_url: next_url,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


92
93
94
95
96
97
98
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 92

def self.validate_raw(obj:)
  obj.limit.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.")
  obj.result_count.is_a?(Integer) != false || raise("Passed value for field obj.result_count is not the expected type, validation failed.")
  obj.current_url.is_a?(String) != false || raise("Passed value for field obj.current_url is not the expected type, validation failed.")
  obj.prev_url&.is_a?(String) != false || raise("Passed value for field obj.prev_url is not the expected type, validation failed.")
  obj.next_url&.is_a?(String) != false || raise("Passed value for field obj.next_url is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PageDetails to a JSON object

Returns:

  • (String)


82
83
84
# File 'lib/assemblyai/transcripts/types/page_details.rb', line 82

def to_json(*_args)
  @_field_set&.to_json
end