Class: Mindee::Parsing::V2::InferenceFile

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/v2/inference_file.rb

Overview

Information about a file returned in an inference.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_response) ⇒ InferenceFile

Returns a new instance of InferenceFile.

Parameters:

  • server_response (Hash)

    Raw JSON parsed into a Hash.



18
19
20
21
22
23
# File 'lib/mindee/parsing/v2/inference_file.rb', line 18

def initialize(server_response)
  @name       = server_response['name']
  @file_alias = server_response['alias']
  @page_count = server_response['page_count']
  @mime_type  = server_response['mime_type']
end

Instance Attribute Details

#file_aliasString? (readonly)

Returns Optional alias for the file.

Returns:

  • (String, nil)

    Optional alias for the file.



11
12
13
# File 'lib/mindee/parsing/v2/inference_file.rb', line 11

def file_alias
  @file_alias
end

#mime_typeString (readonly)

Returns MIME type.

Returns:

  • (String)

    MIME type.



15
16
17
# File 'lib/mindee/parsing/v2/inference_file.rb', line 15

def mime_type
  @mime_type
end

#nameString (readonly)

Returns File name.

Returns:

  • (String)

    File name.



9
10
11
# File 'lib/mindee/parsing/v2/inference_file.rb', line 9

def name
  @name
end

#page_countInteger (readonly)

Returns Page count.

Returns:

  • (Integer)

    Page count.



13
14
15
# File 'lib/mindee/parsing/v2/inference_file.rb', line 13

def page_count
  @page_count
end

Instance Method Details

#to_sString

String representation.

Returns:

  • (String)


27
28
29
30
31
32
33
34
# File 'lib/mindee/parsing/v2/inference_file.rb', line 27

def to_s
  "File\n" \
    "====\n" \
    ":Name: #{@name}\n" \
    ":Alias:#{" #{@file_alias}" if @file_alias}\n" \
    ":Page Count: #{@page_count}\n" \
    ":MIME Type: #{@mime_type}\n"
end