Class: ContextDev::Models::NewsSearchResponse::Data

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/context_dev/models/news_search_response.rb,
sig/context_dev/models/news_search_response.rbs

Defined Under Namespace

Modules: Type Classes: Match, Source

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(direct:, domain:, name:) ⇒ Object

The publication that published the article.

Parameters:

  • direct (Boolean)

    True when Context observed this article in the publisher-owned feed.

  • domain (String)

    Website domain of the publication.

  • name (String)

    Name of the publication, such as Reuters.



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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/context_dev/models/news_search_response.rb', line 53

class Data < ContextDev::Internal::Type::BaseModel
  # @!attribute id
  #   Stable unique identifier for this article. Use it to deduplicate or reference an
  #   article across requests.
  #
  #   @return [String]
  required :id, String

  # @!attribute authors
  #   Bylined authors. Empty when no byline is available.
  #
  #   @return [Array<String>]
  required :authors, ContextDev::Internal::Type::ArrayOf[String]

  # @!attribute description
  #   Short summary or excerpt of the article, when the publisher provides one.
  #
  #   @return [String, nil]
  required :description, String, nil?: true

  # @!attribute image_url
  #   Lead image for the article, when one is available.
  #
  #   @return [String, nil]
  required :image_url, String, nil?: true

  # @!attribute language
  #   Language the article is written in, as a lowercase ISO 639-1 code such as en.
  #   Null when unknown.
  #
  #   @return [String, nil]
  required :language, String, nil?: true

  # @!attribute match
  #   How the article relates to the company you searched for.
  #
  #   @return [ContextDev::Models::NewsSearchResponse::Data::Match]
  required :match, -> { ContextDev::Models::NewsSearchResponse::Data::Match }

  # @!attribute published_at
  #   When the article was published, as an ISO 8601 timestamp. Null when the
  #   publisher does not state a reliable date.
  #
  #   @return [Time, nil]
  required :published_at, Time, nil?: true

  # @!attribute source
  #   The publication that published the article.
  #
  #   @return [ContextDev::Models::NewsSearchResponse::Data::Source]
  required :source, -> { ContextDev::Models::NewsSearchResponse::Data::Source }

  # @!attribute story_id
  #   Shared by articles covering the same story on the same day. Use it to group or
  #   collapse syndicated copies of one announcement across outlets.
  #
  #   @return [String]
  required :story_id, String

  # @!attribute title
  #   Article headline.
  #
  #   @return [String]
  required :title, String

  # @!attribute type
  #   Kind of coverage. Use it to separate independent reporting (editorial) from
  #   company-issued content (press_release, regulatory_filing, advisory).
  #
  #   @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type]
  required :type, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Type }

  # @!attribute url
  #   Link to the article on the publisher site.
  #
  #   @return [String]
  required :url, String

  # @!method initialize(id:, authors:, description:, image_url:, language:, match:, published_at:, source:, story_id:, title:, type:, url:)
  #   Some parameter documentations has been truncated, see
  #   {ContextDev::Models::NewsSearchResponse::Data} for more details.
  #
  #   @param id [String] Stable unique identifier for this article. Use it to deduplicate or reference an
  #
  #   @param authors [Array<String>] Bylined authors. Empty when no byline is available.
  #
  #   @param description [String, nil] Short summary or excerpt of the article, when the publisher provides one.
  #
  #   @param image_url [String, nil] Lead image for the article, when one is available.
  #
  #   @param language [String, nil] Language the article is written in, as a lowercase ISO 639-1 code such as en. Nu
  #
  #   @param match [ContextDev::Models::NewsSearchResponse::Data::Match] How the article relates to the company you searched for.
  #
  #   @param published_at [Time, nil] When the article was published, as an ISO 8601 timestamp. Null when the publishe
  #
  #   @param source [ContextDev::Models::NewsSearchResponse::Data::Source] The publication that published the article.
  #
  #   @param story_id [String] Shared by articles covering the same story on the same day. Use it to group or c
  #
  #   @param title [String] Article headline.
  #
  #   @param type [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type] Kind of coverage. Use it to separate independent reporting (editorial) from comp
  #
  #   @param url [String] Link to the article on the publisher site.

  # @see ContextDev::Models::NewsSearchResponse::Data#match
  class Match < ContextDev::Internal::Type::BaseModel
    # @!attribute confidence
    #   How confident the match is, from 0 to 1. Null when a score is unavailable.
    #
    #   @return [Float, nil]
    required :confidence, Float, nil?: true

    # @!attribute level
    #   primary when the article is mainly about the company, secondary when the company
    #   is mentioned but is not the main subject.
    #
    #   @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level]
    required :level, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Match::Level }

    # @!method initialize(confidence:, level:)
    #   Some parameter documentations has been truncated, see
    #   {ContextDev::Models::NewsSearchResponse::Data::Match} for more details.
    #
    #   How the article relates to the company you searched for.
    #
    #   @param confidence [Float, nil] How confident the match is, from 0 to 1. Null when a score is unavailable.
    #
    #   @param level [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level] primary when the article is mainly about the company, secondary when the company

    # primary when the article is mainly about the company, secondary when the company
    # is mentioned but is not the main subject.
    #
    # @see ContextDev::Models::NewsSearchResponse::Data::Match#level
    module Level
      extend ContextDev::Internal::Type::Enum

      PRIMARY = :primary
      SECONDARY = :secondary

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

  # @see ContextDev::Models::NewsSearchResponse::Data#source
  class Source < ContextDev::Internal::Type::BaseModel
    # @!attribute direct
    #   True when Context observed this article in the publisher-owned feed.
    #
    #   @return [Boolean]
    required :direct, ContextDev::Internal::Type::Boolean

    # @!attribute domain
    #   Website domain of the publication.
    #
    #   @return [String]
    required :domain, String

    # @!attribute name
    #   Name of the publication, such as Reuters.
    #
    #   @return [String]
    required :name, String

    # @!method initialize(direct:, domain:, name:)
    #   The publication that published the article.
    #
    #   @param direct [Boolean] True when Context observed this article in the publisher-owned feed.
    #
    #   @param domain [String] Website domain of the publication.
    #
    #   @param name [String] Name of the publication, such as Reuters.
  end

  # Kind of coverage. Use it to separate independent reporting (editorial) from
  # company-issued content (press_release, regulatory_filing, advisory).
  #
  # @see ContextDev::Models::NewsSearchResponse::Data#type
  module Type
    extend ContextDev::Internal::Type::Enum

    EDITORIAL = :editorial
    PRESS_RELEASE = :press_release
    REGULATORY_FILING = :regulatory_filing
    ADVISORY = :advisory

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

Instance Attribute Details

#authorsArray<String>

Bylined authors. Empty when no byline is available.

Parameters:

  • value (::Array[String])

Returns:

  • (Array<String>)


65
# File 'lib/context_dev/models/news_search_response.rb', line 65

required :authors, ContextDev::Internal::Type::ArrayOf[String]

#descriptionString?

Short summary or excerpt of the article, when the publisher provides one.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


71
# File 'lib/context_dev/models/news_search_response.rb', line 71

required :description, String, nil?: true

#idString

Stable unique identifier for this article. Use it to deduplicate or reference an article across requests.

Parameters:

  • value (String)

Returns:

  • (String)


59
# File 'lib/context_dev/models/news_search_response.rb', line 59

required :id, String

#image_urlString?

Lead image for the article, when one is available.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


77
# File 'lib/context_dev/models/news_search_response.rb', line 77

required :image_url, String, nil?: true

#languageString?

Language the article is written in, as a lowercase ISO 639-1 code such as en. Null when unknown.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


84
# File 'lib/context_dev/models/news_search_response.rb', line 84

required :language, String, nil?: true

#matchContextDev::Models::NewsSearchResponse::Data::Match

How the article relates to the company you searched for.



90
# File 'lib/context_dev/models/news_search_response.rb', line 90

required :match, -> { ContextDev::Models::NewsSearchResponse::Data::Match }

#published_atTime?

When the article was published, as an ISO 8601 timestamp. Null when the publisher does not state a reliable date.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


97
# File 'lib/context_dev/models/news_search_response.rb', line 97

required :published_at, Time, nil?: true

#sourceContextDev::Models::NewsSearchResponse::Data::Source

The publication that published the article.



103
# File 'lib/context_dev/models/news_search_response.rb', line 103

required :source, -> { ContextDev::Models::NewsSearchResponse::Data::Source }

#story_idString

Shared by articles covering the same story on the same day. Use it to group or collapse syndicated copies of one announcement across outlets.

Parameters:

  • value (String)

Returns:

  • (String)


110
# File 'lib/context_dev/models/news_search_response.rb', line 110

required :story_id, String

#titleString

Article headline.

Parameters:

  • value (String)

Returns:

  • (String)


116
# File 'lib/context_dev/models/news_search_response.rb', line 116

required :title, String

#typeSymbol, ContextDev::Models::NewsSearchResponse::Data::Type

Kind of coverage. Use it to separate independent reporting (editorial) from company-issued content (press_release, regulatory_filing, advisory).

Parameters:

  • value (ContextDev::Models::NewsSearchResponse::Data::type_)

Returns:



123
# File 'lib/context_dev/models/news_search_response.rb', line 123

required :type, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Type }

#urlString

Link to the article on the publisher site.

Parameters:

  • value (String)

Returns:

  • (String)


129
# File 'lib/context_dev/models/news_search_response.rb', line 129

required :url, String

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/context_dev/models/news_search_response.rb', line 194

Instance Method Details

#to_hash{

Returns:

  • ({)


99
# File 'sig/context_dev/models/news_search_response.rbs', line 99

def to_hash: -> {