Module: Avmtrf1::Esosti::Instance::Changed

Included in:
Avmtrf1::Esosti::Instance
Defined in:
lib/avmtrf1/esosti/instance/changed.rb

Instance Method Summary collapse

Instance Method Details

#changed(since) ⇒ Object


10
11
12
# File 'lib/avmtrf1/esosti/instance/changed.rb', line 10

def changed(since)
  changed_request(since).response.body_data_or_raise
end

#changed_request(since) ⇒ Object


14
15
16
17
18
19
20
# File 'lib/avmtrf1/esosti/instance/changed.rb', line 14

def changed_request(since)
  request_json(changed_url_suffix(since)) do |data|
    ::Avmtrf1::Esosti::RawDataSanitizer.sanitize(
      data.fetch('TICKETMboSet').fetch('TICKET')
    ).map { |ticket| ticket.fetch('Attributes').fetch('TICKETID').downcase }
  end
end

#changed_url_suffix(since) ⇒ Object


22
23
24
25
# File 'lib/avmtrf1/esosti/instance/changed.rb', line 22

def changed_url_suffix(since)
  '/mbo/ticket?_includecols=ticketid&changedate=~gt~' +
    ::CGI.escape(formatted_time(since))
end

#formatted_time(time) ⇒ Object


27
28
29
# File 'lib/avmtrf1/esosti/instance/changed.rb', line 27

def formatted_time(time)
  time.strftime('%FT%T%:z')
end