Class: Finlight::ArticleResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/finlight/models.rb

Overview

A page of search results.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, page:, page_size:, articles:) ⇒ ArticleResponse

Returns a new instance of ArticleResponse.



154
155
156
157
158
159
# File 'lib/finlight/models.rb', line 154

def initialize(status:, page:, page_size:, articles:)
  @status = status
  @page = page
  @page_size = page_size
  @articles = articles
end

Instance Attribute Details

#articlesObject (readonly)

Returns the value of attribute articles.



152
153
154
# File 'lib/finlight/models.rb', line 152

def articles
  @articles
end

#pageObject (readonly)

Returns the value of attribute page.



152
153
154
# File 'lib/finlight/models.rb', line 152

def page
  @page
end

#page_sizeObject (readonly)

Returns the value of attribute page_size.



152
153
154
# File 'lib/finlight/models.rb', line 152

def page_size
  @page_size
end

#statusObject (readonly)

Returns the value of attribute status.



152
153
154
# File 'lib/finlight/models.rb', line 152

def status
  @status
end

Class Method Details

.from_h(hash) ⇒ Object



161
162
163
164
165
166
167
168
# File 'lib/finlight/models.rb', line 161

def self.from_h(hash)
  new(
    status: hash["status"],
    page: hash["page"],
    page_size: hash["pageSize"],
    articles: (hash["articles"] || []).map { |a| Article.from_h(a) }
  )
end