Class: ContextDev::Models::WebWebScrapeImagesResponse::Image

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/context_dev/models/web_web_scrape_images_response.rb

Defined Under Namespace

Modules: Element, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(alt:, element:, src:, type:) ⇒ Object

Parameters:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 33

class Image < ContextDev::Internal::Type::BaseModel
  # @!attribute alt
  #   Alt text of the image, or null if not present
  #
  #   @return [String, nil]
  required :alt, String, nil?: true

  # @!attribute element
  #   The HTML element the image was found in
  #
  #   @return [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Element]
  required :element, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Element }

  # @!attribute src
  #   The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI
  #
  #   @return [String]
  required :src, String

  # @!attribute type
  #   The type/format of the src value
  #
  #   @return [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Type]
  required :type, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Type }

  # @!method initialize(alt:, element:, src:, type:)
  #   @param alt [String, nil] Alt text of the image, or null if not present
  #
  #   @param element [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Element] The HTML element the image was found in
  #
  #   @param src [String] The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI
  #
  #   @param type [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Type] The type/format of the src value

  # The HTML element the image was found in
  #
  # @see ContextDev::Models::WebWebScrapeImagesResponse::Image#element
  module Element
    extend ContextDev::Internal::Type::Enum

    IMG = :img
    SVG = :svg
    LINK = :link
    SOURCE = :source
    VIDEO = :video
    CSS = :css
    OBJECT = :object
    META = :meta
    BACKGROUND = :background

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # The type/format of the src value
  #
  # @see ContextDev::Models::WebWebScrapeImagesResponse::Image#type
  module Type
    extend ContextDev::Internal::Type::Enum

    URL = :url
    HTML = :html
    BASE64 = :base64

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#altString?

Alt text of the image, or null if not present

Returns:

  • (String, nil)


38
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 38

required :alt, String, nil?: true

#elementSymbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Element

The HTML element the image was found in



44
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 44

required :element, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Element }

#srcString

The image source - can be a URL, inline HTML (for SVGs), or a base64 data URI

Returns:

  • (String)


50
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 50

required :src, String

#typeSymbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Type

The type/format of the src value



56
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 56

required :type, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Type }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 83