Class: Kagi::API::Models::Content::Search

Inherits:
Data
  • Object
show all
Defined in:
lib/kagi/api/models/content/search.rb

Overview

Models search data.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rank: nil, title: nil, url: nil, snippet: nil, published_at: nil, thumbnail: nil, **attributes) ⇒ Search

rubocop:todo Metrics/ParameterLists



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kagi/api/models/content/search.rb', line 19

def initialize(
  rank: nil,
  title: nil,
  url: nil,
  snippet: nil,
  published_at: nil,
  thumbnail: nil,
  **attributes
)
  super
end

Instance Attribute Details

#published_atObject (readonly)

Returns the value of attribute published_at

Returns:

  • (Object)

    the current value of published_at



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def published_at
  @published_at
end

#rankObject (readonly)

Returns the value of attribute rank

Returns:

  • (Object)

    the current value of rank



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def rank
  @rank
end

#snippetObject (readonly)

Returns the value of attribute snippet

Returns:

  • (Object)

    the current value of snippet



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def snippet
  @snippet
end

#thumbnailObject (readonly)

Returns the value of attribute thumbnail

Returns:

  • (Object)

    the current value of thumbnail



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def thumbnail
  @thumbnail
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



10
11
12
# File 'lib/kagi/api/models/content/search.rb', line 10

def url
  @url
end

Class Method Details

.for(key_map: SEARCH_MAP, **attributes) ⇒ Object



11
12
13
14
15
16
# File 'lib/kagi/api/models/content/search.rb', line 11

def self.for(key_map: SEARCH_MAP, **attributes)
  new(
    **attributes.transform_keys(key_map),
    thumbnail: (Thumbnail[**attributes[:thumbnail]] if attributes.key? :thumbnail)
  )
end