cronofy 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cronofy/client.rb +16 -16
- data/lib/cronofy/types.rb +10 -0
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/auth_spec.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 116368dec8928956ee2044c6aaac191fc0ad42b0
|
4
|
+
data.tar.gz: 3f7525985969bd9442ef05d7997f88b10060acea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84d9b8f66d11577350ecf293c00dd0bd69dd5827595625d410b0709937872ce7c52019eafc5693998dd3d03dcb3bbfe8626d9c8f0f4bc04cc5a0a40106c8bfa0
|
7
|
+
data.tar.gz: cb35302981dae646f87f0ce47aa297a295a3fad4a913b15a1a49592edd9b010042288671f42a9ad7468cb0761f7b3a1adbe298434cee8cc2a801af3f0817a968
|
data/lib/cronofy/client.rb
CHANGED
@@ -107,22 +107,6 @@ module Cronofy
|
|
107
107
|
nil
|
108
108
|
end
|
109
109
|
|
110
|
-
def encode_event_time(time)
|
111
|
-
result = time
|
112
|
-
|
113
|
-
case time
|
114
|
-
when Hash
|
115
|
-
if time[:time]
|
116
|
-
encoded_time = encode_event_time(time[:time])
|
117
|
-
time.merge(time: encoded_time)
|
118
|
-
else
|
119
|
-
time
|
120
|
-
end
|
121
|
-
else
|
122
|
-
to_iso8601(time)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
110
|
# Public: Alias for #upsert_event
|
127
111
|
alias_method :create_or_update_event, :upsert_event
|
128
112
|
|
@@ -507,6 +491,22 @@ module Cronofy
|
|
507
491
|
end
|
508
492
|
end
|
509
493
|
|
494
|
+
def encode_event_time(time)
|
495
|
+
result = time
|
496
|
+
|
497
|
+
case time
|
498
|
+
when Hash
|
499
|
+
if time[:time]
|
500
|
+
encoded_time = encode_event_time(time[:time])
|
501
|
+
time.merge(time: encoded_time)
|
502
|
+
else
|
503
|
+
time
|
504
|
+
end
|
505
|
+
else
|
506
|
+
to_iso8601(time)
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
510
|
class PagedResultIterator
|
511
511
|
include Enumerable
|
512
512
|
|
data/lib/cronofy/types.rb
CHANGED
@@ -4,18 +4,28 @@ require "time"
|
|
4
4
|
|
5
5
|
module Cronofy
|
6
6
|
class Credentials
|
7
|
+
class LinkingProfile < Hashie::Mash
|
8
|
+
end
|
9
|
+
|
7
10
|
attr_reader :access_token
|
11
|
+
attr_reader :account_id
|
8
12
|
attr_reader :expires_at
|
9
13
|
attr_reader :expires_in
|
14
|
+
attr_reader :linking_profile
|
10
15
|
attr_reader :refresh_token
|
11
16
|
attr_reader :scope
|
12
17
|
|
13
18
|
def initialize(oauth_token)
|
14
19
|
@access_token = oauth_token.token
|
20
|
+
@account_id = oauth_token.params['account_id']
|
15
21
|
@expires_at = oauth_token.expires_at
|
16
22
|
@expires_in = oauth_token.expires_in
|
17
23
|
@refresh_token = oauth_token.refresh_token
|
18
24
|
@scope = oauth_token.params['scope']
|
25
|
+
|
26
|
+
if details = oauth_token.params['linking_profile']
|
27
|
+
@linking_profile = LinkingProfile.new(details)
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
def to_h
|
data/lib/cronofy/version.rb
CHANGED
@@ -14,6 +14,9 @@ describe Cronofy::Auth do
|
|
14
14
|
let(:expires_in) { 10000 }
|
15
15
|
let(:scope) { 'read_events list_calendars create_event' }
|
16
16
|
|
17
|
+
let(:linking_profile_hash) { nil }
|
18
|
+
let(:account_id) { nil }
|
19
|
+
|
17
20
|
before(:all) do
|
18
21
|
WebMock.reset!
|
19
22
|
WebMock.disable_net_connect!(allow_localhost: true)
|
@@ -71,6 +74,8 @@ describe Cronofy::Auth do
|
|
71
74
|
expires_in: expires_in,
|
72
75
|
refresh_token: new_refresh_token,
|
73
76
|
scope: scope,
|
77
|
+
account_id: account_id,
|
78
|
+
linking_profile: linking_profile_hash,
|
74
79
|
}.to_json,
|
75
80
|
headers: {
|
76
81
|
"Content-Type" => "application/json; charset=utf-8"
|
@@ -178,6 +183,29 @@ describe Cronofy::Auth do
|
|
178
183
|
describe '#get_token_from_code' do
|
179
184
|
subject { Cronofy::Auth.new(client_id, client_secret).get_token_from_code(code, redirect_uri) }
|
180
185
|
|
186
|
+
context "with account_id" do
|
187
|
+
let(:account_id) { "acc_0123456789abc" }
|
188
|
+
|
189
|
+
it 'exposes the account_id' do
|
190
|
+
expect(subject.account_id).to eq account_id
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context "with linking profile" do
|
195
|
+
let(:linking_profile_hash) do
|
196
|
+
{
|
197
|
+
provider_name: "google",
|
198
|
+
profile_id: "pro_VmrZnDitjScsAAAG",
|
199
|
+
profile_name: "bob@example.com",
|
200
|
+
}
|
201
|
+
end
|
202
|
+
|
203
|
+
it "exposes the linking profile" do
|
204
|
+
expected = Cronofy::Credentials::LinkingProfile.new(linking_profile_hash)
|
205
|
+
expect(subject.linking_profile).to eq expected
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
181
209
|
it_behaves_like 'an authorization request'
|
182
210
|
end
|
183
211
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cronofy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergii Paryzhskyi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|