Class: Stattleship::Endpoint

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/stattleship/endpoint.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fetch(path:, params:) ⇒ Object


3
4
5
6
7
# File 'lib/stattleship/endpoint.rb', line 3

def self.fetch(path:, params:)
  Stattleship::Client.new(path: path,
                          query: params.query).
    paginate(model: self)
end

Instance Method Details

#dataObject


9
10
11
# File 'lib/stattleship/endpoint.rb', line 9

def data
  @data ||= populate
end

#populateObject


13
14
15
# File 'lib/stattleship/endpoint.rb', line 13

def populate
  raise 'Endpoint subclass must implement populate'
end