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

Parameters:

  • direct (Boolean)

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

  • domain (String)
  • name (String)


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
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
# File 'lib/context_dev/models/news_search_response.rb', line 48

class Data < ContextDev::Internal::Type::BaseModel
  # @!attribute id
  #
  #   @return [String]
  required :id, String

  # @!attribute authors
  #
  #   @return [Array<String>]
  required :authors, ContextDev::Internal::Type::ArrayOf[String]

  # @!attribute description
  #
  #   @return [String, nil]
  required :description, String, nil?: true

  # @!attribute image_url
  #
  #   @return [String, nil]
  required :image_url, String, nil?: true

  # @!attribute language
  #
  #   @return [String, nil]
  required :language, String, nil?: true

  # @!attribute match
  #
  #   @return [ContextDev::Models::NewsSearchResponse::Data::Match]
  required :match, -> { ContextDev::Models::NewsSearchResponse::Data::Match }

  # @!attribute published_at
  #
  #   @return [Time, nil]
  required :published_at, Time, nil?: true

  # @!attribute source
  #
  #   @return [ContextDev::Models::NewsSearchResponse::Data::Source]
  required :source, -> { ContextDev::Models::NewsSearchResponse::Data::Source }

  # @!attribute story_id
  #   Groups matching normalized headlines published on the same UTC day.
  #
  #   @return [String]
  required :story_id, String

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

  # @!attribute type
  #
  #   @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type]
  required :type, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Type }

  # @!attribute url
  #
  #   @return [String]
  required :url, String

  # @!method initialize(id:, authors:, description:, image_url:, language:, match:, published_at:, source:, story_id:, title:, type:, url:)
  #   @param id [String]
  #
  #   @param authors [Array<String>]
  #
  #   @param description [String, nil]
  #
  #   @param image_url [String, nil]
  #
  #   @param language [String, nil]
  #
  #   @param match [ContextDev::Models::NewsSearchResponse::Data::Match]
  #
  #   @param published_at [Time, nil]
  #
  #   @param source [ContextDev::Models::NewsSearchResponse::Data::Source]
  #
  #   @param story_id [String] Groups matching normalized headlines published on the same UTC day.
  #
  #   @param title [String]
  #
  #   @param type [Symbol, ContextDev::Models::NewsSearchResponse::Data::Type]
  #
  #   @param url [String]

  # @see ContextDev::Models::NewsSearchResponse::Data#match
  class Match < ContextDev::Internal::Type::BaseModel
    # @!attribute confidence
    #
    #   @return [Float, nil]
    required :confidence, Float, nil?: true

    # @!attribute level
    #
    #   @return [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level]
    required :level, enum: -> { ContextDev::Models::NewsSearchResponse::Data::Match::Level }

    # @!method initialize(confidence:, level:)
    #   @param confidence [Float, nil]
    #   @param level [Symbol, ContextDev::Models::NewsSearchResponse::Data::Match::Level]

    # @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
    #
    #   @return [String]
    required :domain, String

    # @!attribute name
    #
    #   @return [String]
    required :name, String

    # @!method initialize(direct:, domain:, name:)
    #   @param direct [Boolean] True when Context observed this article in the publisher-owned feed.
    #
    #   @param domain [String]
    #
    #   @param name [String]
  end

  # @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>

Parameters:

  • value (::Array[String])

Returns:

  • (Array<String>)


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

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

#descriptionString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


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

required :description, String, nil?: true

#idString

Parameters:

  • value (String)

Returns:

  • (String)


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

required :id, String

#image_urlString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


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

required :image_url, String, nil?: true

#languageString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


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

required :language, String, nil?: true

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



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

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

#published_atTime?

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


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

required :published_at, Time, nil?: true

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



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

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

#story_idString

Groups matching normalized headlines published on the same UTC day.

Parameters:

  • value (String)

Returns:

  • (String)


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

required :story_id, String

#titleString

Parameters:

  • value (String)

Returns:

  • (String)


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

required :title, String

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

Parameters:

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

Returns:



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

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

#urlString

Parameters:

  • value (String)

Returns:

  • (String)


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

required :url, String

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


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

Instance Method Details

#to_hash{

Returns:

  • ({)


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

def to_hash: -> {