omnievent-google 0.1.0.pre2 → 0.1.0.pre4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 582c4cf9831a82c8e9486939f5df891635c9f8c4de75eb334563616f13ef50b1
4
- data.tar.gz: 4ecb96a099fb0d18754ddce917b14363700742abffb7aef4999b80357c6e22ec
3
+ metadata.gz: f0da08dfc39ca1d3912e18b576d42e684e8a7eb593140391ac0cfbc007826878
4
+ data.tar.gz: 44ee373377dd2062cbd0386a2954ef2b823014d5929ae9cd403682e9ecbc4538
5
5
  SHA512:
6
- metadata.gz: 1bb759fe04b74d3acc40dabac35617a386aecdc37980b652124aff5b01892e56277d6db6428a2af22808674ebadcc085b766c42357b6093c3879e7dd8ee278af
7
- data.tar.gz: 59fd7b9593e51a1927f1da44e8ea6adbe12ebbc9e7a01feec793fcef3118034356e146622b1c62c733447f9aa87a894d4f6e2e962a25cc5828c88782f40c9e1a
6
+ metadata.gz: 55559e8dd02abd686ac26285a5f1d8c4e2e057b63abe9a074db5c960cda91f931c92f29f0eab9bab298f3ab9d8d12f7a734c39e410797007935de1851e731856
7
+ data.tar.gz: 640619807882127fcc589e63e68a7a79a04ab16e8b2092056aec95392d03810feafc53a19b63cae3f44eaf742ad8c330125aa6a03a679383b3e5262002b64361
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnievent-google (0.1.0.pre1)
4
+ omnievent-google (0.1.0.pre3)
5
5
  omnievent
6
6
  omnievent-api
7
7
 
@@ -24,11 +24,11 @@ GEM
24
24
  iso-639 (0.3.6)
25
25
  json (2.7.2)
26
26
  language_server-protocol (3.17.0.3)
27
- omnievent (0.1.0.pre6)
27
+ omnievent (0.1.0.pre7)
28
28
  hashie (>= 3.4.6)
29
29
  iso-639 (~> 0.3.5)
30
30
  tzinfo (~> 2.0)
31
- omnievent-api (0.1.0.pre3)
31
+ omnievent-api (0.1.0.pre4)
32
32
  excon
33
33
  omnievent
34
34
  parallel (1.26.3)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniEvent
4
4
  module Google
5
- VERSION = "0.1.0.pre2"
5
+ VERSION = "0.1.0.pre4"
6
6
  end
7
7
  end
@@ -14,15 +14,16 @@ module OmniEvent
14
14
  API_VERSION = "v3"
15
15
 
16
16
  def raw_events
17
- params = options.slice(:from_time, :to_time)
18
- response = perform_request(path: request_path_with_params(params))
19
- events = response && response["items"]
17
+ response = perform_request(path: path_with_params(request_path, list_params))
18
+ return [] unless response.is_a?(Hash) && response["items"]
20
19
 
21
- next_link = build_next_link(response, params)
20
+ events = response["items"]
21
+
22
+ next_link = build_next_link(response, list_params)
22
23
  while next_link
23
24
  response = perform_request(path: next_link)
24
25
  events << response["value"]
25
- next_link = build_next_link(response, params)
26
+ next_link = build_next_link(response, list_params)
26
27
  end
27
28
 
28
29
  events
@@ -31,7 +32,7 @@ module OmniEvent
31
32
  def build_next_link(response, params)
32
33
  return nil unless response && response["nextPageToken"]
33
34
 
34
- request_path_with_params(params.merge(pageToken: response["nextPageToken"]))
35
+ path_with_params(request_path, params.merge(pageToken: response["nextPageToken"]))
35
36
  end
36
37
 
37
38
  def create_event
@@ -122,13 +123,6 @@ module OmniEvent
122
123
  end
123
124
  end
124
125
 
125
- def request_path_with_params(params = {})
126
- uri = URI.parse(request_path)
127
- params.reject! { |_k, v| v.to_s.strip.empty? }
128
- uri.query = URI.encode_www_form(params) unless params.empty?
129
- uri.to_s
130
- end
131
-
132
126
  def request_url
133
127
  "https://www.googleapis.com"
134
128
  end
@@ -162,6 +156,16 @@ module OmniEvent
162
156
  "timeZone": "UTC"
163
157
  }
164
158
  end
159
+
160
+ def list_params
161
+ @list_params ||= begin
162
+ params = {}
163
+ params[:timeMin] = options.from_time if options.from_time
164
+ params[:timeMax] = options.to_time if options.to_time
165
+ params[:q] = options.match_name if options.match_name
166
+ params
167
+ end
168
+ end
165
169
  end
166
170
  end
167
171
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnievent-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
4
+ version: 0.1.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angus McLeod