tvtid 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36fbfc05fddc5323e3c0e56abf9ced86dc074474
4
- data.tar.gz: 310a1705cfae16aa41e43b6fed1a8c7b4e9478f3
3
+ metadata.gz: 36f09543a21bf47099180ad3ffbdfa4f71b58723
4
+ data.tar.gz: 21e425de70f4421c6bf6f451fd7dd8bdd98a346e
5
5
  SHA512:
6
- metadata.gz: 4cff228acd985786abea49798e260d243a271754620e56e1a5e89e64b6570476558d1dba1de25efb9be505238c3c36758b5cf167d6b98837f380427ca7c07d24
7
- data.tar.gz: 5605ff062067d737fa91e69142d16174c735955c3e4917541ea2d4714bc45dd3a10658066a5e2edc9f045306d74126c974a0b4777d7c5bf2cf58426d0bd75244
6
+ metadata.gz: 77dbbe1823ad49b1070159b1141e0db9db3119ea21777b893704ef689eea84473a8c6624eb4fe4264e39958dab8f4b3193ad72c322e93527eb0b1a0dad5186c2
7
+ data.tar.gz: 2f7faacdf0d2998f9ea0a0b453f3e36f82e55bf2d8f0e18a53c08e9ae424c79323b66df5ccd668f2a1d8a10114e37f8ada61d6d855b39cf7772da45fb1f0d16a
@@ -7,11 +7,12 @@ module TVTid
7
7
  # The soft cache time to live.
8
8
  CACHE_SOFT_TTL = 7 * 60 * 60 * 24 # 7 days
9
9
  # The API backend host.
10
- API_BASE_URI = URI 'http://tvtid-app-backend.tv2.dk'
10
+ API_BASE_URI = URI 'http://tvtid-backend.tv2.dk/tvtid-app-backend'
11
11
 
12
12
  # The default HTTP request headers
13
13
  HTTP_REQUEST_HEADERS = {
14
- 'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'
14
+ 'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36',
15
+ 'Accept' => 'application/json'
15
16
  }
16
17
 
17
18
  # The default channels to return in a days schedule
@@ -40,7 +41,7 @@ module TVTid
40
41
 
41
42
  @cache.fetch cache_key do
42
43
  channel_queries = channels.map{|c| "ch=#{c.id}" }.join '&'
43
- response = @http.get "/api/tvtid/v1/dayviews/#{formatted_date}?#{channel_queries}", HTTP_REQUEST_HEADERS
44
+ response = @http.get "/tvtid-app-backend/dayviews/#{formatted_date}?#{channel_queries}", HTTP_REQUEST_HEADERS
44
45
  json_data = MultiJson.load response.body
45
46
 
46
47
  json_data.map do |schedule|
@@ -61,7 +62,13 @@ module TVTid
61
62
  #
62
63
  # This is equivalent to using `chedules_for Date.today`
63
64
  def schedules_for_today channels = []
64
- schedules_for Date.today, channels
65
+ date_time = DateTime.now
66
+
67
+ if date_time.hour <= 5 and date_time.hour >= 0
68
+ date_time = date_time.now - 1
69
+ end
70
+
71
+ schedules_for date_time.to_date, channels
65
72
  end
66
73
 
67
74
  # Returns a days schedule for a given channel and date
@@ -75,7 +82,7 @@ module TVTid
75
82
  # Returns a list of channels
76
83
  def channels
77
84
  @cache.fetch 'channels' do
78
- response = @http.get '/api/tvtid/v1/channels', HTTP_REQUEST_HEADERS
85
+ response = @http.get '/tvtid-app-backend/channels', HTTP_REQUEST_HEADERS
79
86
 
80
87
  json_data = MultiJson.load response.body
81
88
  json_data.map{|json_channel_data| Channel.from_json json_channel_data }
@@ -86,7 +93,7 @@ module TVTid
86
93
  #
87
94
  # @return [Program] the program
88
95
  def get_program_details! program
89
- response = @http.get "/api/tvtid/v1/channels/#{program.channel_id}/programs/#{program.id}", HTTP_REQUEST_HEADERS
96
+ response = @http.get "/tvtid-app-backend/channels/#{program.channel_id}/programs/#{program.id}", HTTP_REQUEST_HEADERS
90
97
 
91
98
  if response.code == '200'
92
99
  program.parse_json! MultiJson.load(response.body)
@@ -1,3 +1,3 @@
1
1
  module TVTid
2
- Version = '0.3'
2
+ Version = '0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tvtid
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Kroman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.5.2
205
+ rubygems_version: 2.6.13
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Client library for tvtid.tv2.dk