Class: Everlog::Dom::Module::Moves

Inherits:
Everlog::Dom::Module show all
Defined in:
lib/everlog/dom/module/moves.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Everlog::Dom::Module

#initialize

Constructor Details

This class inherits a constructor from Everlog::Dom::Module

Class Method Details

.fetch_since(date) ⇒ Object

date対応してない



24
25
26
27
# File 'lib/everlog/dom/module/moves.rb', line 24

def fetch_since date
  instance = self.new
  { summary: instance.summary, storyline: instance.storyline }
end

Instance Method Details

#api_clientObject



3
4
5
# File 'lib/everlog/dom/module/moves.rb', line 3

def api_client
  @api_client ||= Inf::Api::Moves.new(@config)
end

#storylineObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/everlog/dom/module/moves.rb', line 7

def storyline
  api_client.daily_storyline.map do |story|
    case story['type']
    when 'place'
      Dom::Value::Moves::Referer::Place.new story
    when 'move'
      Dom::Value::Moves::Referer::Move.new story
    end
  end
end

#summaryObject



18
19
20
# File 'lib/everlog/dom/module/moves.rb', line 18

def summary
  Dom::Value::Moves::Summary.new(api_client.daily_summary)
end