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 Classes: Enrichment

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:, enrichment: nil) ⇒ 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/context_dev/models/web_web_scrape_images_response.rb', line 33

class Image < ContextDev::Internal::Type::BaseModel
  # @!attribute alt
  #   Image alt text, or null when unavailable.
  #
  #   @return [String, nil]
  required :alt, String, nil?: true

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

  # @!attribute src
  #   Original image value: URL, inline SVG or HTML, or base64 data URI.
  #
  #   @return [String]
  required :src, String

  # @!attribute type
  #   Format of src.
  #
  #   @return [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Type]
  required :type, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Type }

  # @!attribute enrichment
  #   Requested metadata for images that could be processed.
  #
  #   @return [ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment, nil]
  optional :enrichment, -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment }

  # @!method initialize(alt:, element:, src:, type:, enrichment: nil)
  #   @param alt [String, nil] Image alt text, or null when unavailable.
  #
  #   @param element [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Element] Where the image was found.
  #
  #   @param src [String] Original image value: URL, inline SVG or HTML, or base64 data URI.
  #
  #   @param type [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Type] Format of src.
  #
  #   @param enrichment [ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment] Requested metadata for images that could be processed.

  # Where the image was found.
  #
  # @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

  # Format of src.
  #
  # @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

  # @see ContextDev::Models::WebWebScrapeImagesResponse::Image#enrichment
  class Enrichment < ContextDev::Internal::Type::BaseModel
    # @!attribute height
    #   Image height in pixels, when measured.
    #
    #   @return [Integer, nil]
    optional :height, Integer

    # @!attribute mimetype
    #   Detected MIME type, when hosted.
    #
    #   @return [String, nil]
    optional :mimetype, String

    # @!attribute type
    #   Visual asset category, when classified.
    #
    #   @return [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment::Type, nil]
    optional :type, enum: -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment::Type }

    # @!attribute url
    #   Brand.dev CDN URL, when hosted.
    #
    #   @return [String, nil]
    optional :url, String

    # @!attribute width
    #   Image width in pixels, when measured.
    #
    #   @return [Integer, nil]
    optional :width, Integer

    # @!method initialize(height: nil, mimetype: nil, type: nil, url: nil, width: nil)
    #   Requested metadata for images that could be processed.
    #
    #   @param height [Integer] Image height in pixels, when measured.
    #
    #   @param mimetype [String] Detected MIME type, when hosted.
    #
    #   @param type [Symbol, ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment::Type] Visual asset category, when classified.
    #
    #   @param url [String] Brand.dev CDN URL, when hosted.
    #
    #   @param width [Integer] Image width in pixels, when measured.

    # Visual asset category, when classified.
    #
    # @see ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment#type
    module Type
      extend ContextDev::Internal::Type::Enum

      PHOTOGRAPHY = :photography
      ILLUSTRATION = :illustration
      LOGO = :logo
      WORDMARK = :wordmark
      ICON = :icon
      PATTERN = :pattern
      GRAPHIC = :graphic
      OTHER = :other

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

Instance Attribute Details

#altString?

Image alt text, or null when unavailable.

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

Where the image was found.



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

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

#enrichmentContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment?

Requested metadata for images that could be processed.



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

optional :enrichment, -> { ContextDev::Models::WebWebScrapeImagesResponse::Image::Enrichment }

#srcString

Original image value: URL, inline SVG or HTML, or 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

Format of src.



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 91