Class: Eventify::Provider::Piletilevi
- Defined in:
- lib/eventify/provider/piletilevi.rb
Constant Summary collapse
- URL =
URI.parse("http://www.piletilevi.ee/ajaxCaller/method:getConcertsList/start:0/limit:500/id:58103/type:any/")
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Methods inherited from Base
#<=>, #==, #exists?, #hash, #initialize, #provider, #save
Constructor Details
This class inherits a constructor from Eventify::Provider::Base
Class Method Details
.fetch ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/eventify/provider/piletilevi.rb', line 9 def fetch json = JSON.parse(Faraday.new(url: "#{URL.scheme}://#{URL.host}").get(URL.path).body, symbolize_names: true) rescue {} entries = json[:responseData] && json[:responseData][:concert] || [] entries.map do |entry| new id: entry[:id], title: entry[:title], link: entry[:link], date: Time.at(entry[:modifiedTimeStamp].to_i) end end |