cronofy 0.8.0 → 0.8.1
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 +4 -4
- data/lib/cronofy/types.rb +38 -2
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/auth_spec.rb +26 -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: 3467ae0391c9af2279187f55e7077710c716a62f
|
4
|
+
data.tar.gz: 5aba29d7e88b690d15ed3ddf529c8207af567606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af83971d843ba0ebd4a8043e9f93ab551442b580a45ae1969be56ff4294b680fb2252500503acd2d1c46b34206624c5bb07cfaa291700d0ea422978c2a7565e4
|
7
|
+
data.tar.gz: 1f105236fdd6898bb246bf080265d352dcdedc94d96b65fb48d96b891405a2bddf1a8197e0ad320d9c71f4622c1ec4e6d4b44789c315c8abdde6a805dd8bde42
|
data/lib/cronofy/types.rb
CHANGED
@@ -4,7 +4,33 @@ require "time"
|
|
4
4
|
|
5
5
|
module Cronofy
|
6
6
|
class Credentials
|
7
|
-
class LinkingProfile
|
7
|
+
class LinkingProfile
|
8
|
+
attr_reader :provider_name
|
9
|
+
attr_reader :profile_id
|
10
|
+
attr_reader :profile_name
|
11
|
+
|
12
|
+
def initialize(hash)
|
13
|
+
@provider_name = hash['provider_name'] || hash[:provider_name]
|
14
|
+
@profile_id = hash['profile_id'] || hash[:profile_id]
|
15
|
+
@profile_name = hash['profile_name'] || hash[:profile_name]
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_h
|
19
|
+
{
|
20
|
+
provider_name: provider_name,
|
21
|
+
profile_id: profile_id,
|
22
|
+
profile_name: profile_name,
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def ==(other)
|
27
|
+
case other
|
28
|
+
when LinkingProfile
|
29
|
+
self.provider_name == other.provider_name &&
|
30
|
+
self.profile_id == other.profile_id &&
|
31
|
+
self.profile_name == other.profile_name
|
32
|
+
end
|
33
|
+
end
|
8
34
|
end
|
9
35
|
|
10
36
|
attr_reader :access_token
|
@@ -29,13 +55,23 @@ module Cronofy
|
|
29
55
|
end
|
30
56
|
|
31
57
|
def to_h
|
32
|
-
{
|
58
|
+
hash = {
|
33
59
|
access_token: access_token,
|
34
60
|
expires_at: expires_at,
|
35
61
|
expires_in: expires_in,
|
36
62
|
refresh_token: refresh_token,
|
37
63
|
scope: scope,
|
38
64
|
}
|
65
|
+
|
66
|
+
if account_id
|
67
|
+
hash[:account_id] = account_id
|
68
|
+
end
|
69
|
+
|
70
|
+
if linking_profile
|
71
|
+
hash[:linking_profile] = linking_profile.to_h
|
72
|
+
end
|
73
|
+
|
74
|
+
hash
|
39
75
|
end
|
40
76
|
|
41
77
|
def to_hash
|
data/lib/cronofy/version.rb
CHANGED
@@ -189,6 +189,19 @@ describe Cronofy::Auth do
|
|
189
189
|
it 'exposes the account_id' do
|
190
190
|
expect(subject.account_id).to eq account_id
|
191
191
|
end
|
192
|
+
|
193
|
+
it "includes the account_id in its hash" do
|
194
|
+
expected = {
|
195
|
+
:access_token => subject.access_token,
|
196
|
+
:expires_at => subject.expires_at,
|
197
|
+
:expires_in => subject.expires_in,
|
198
|
+
:refresh_token => subject.refresh_token,
|
199
|
+
:scope => subject.scope,
|
200
|
+
:account_id => account_id,
|
201
|
+
}
|
202
|
+
|
203
|
+
expect(subject.to_h).to eq(expected)
|
204
|
+
end
|
192
205
|
end
|
193
206
|
|
194
207
|
context "with linking profile" do
|
@@ -204,6 +217,19 @@ describe Cronofy::Auth do
|
|
204
217
|
expected = Cronofy::Credentials::LinkingProfile.new(linking_profile_hash)
|
205
218
|
expect(subject.linking_profile).to eq expected
|
206
219
|
end
|
220
|
+
|
221
|
+
it "includes the linking profile in its hash" do
|
222
|
+
expected = {
|
223
|
+
:access_token => subject.access_token,
|
224
|
+
:expires_at => subject.expires_at,
|
225
|
+
:expires_in => subject.expires_in,
|
226
|
+
:refresh_token => subject.refresh_token,
|
227
|
+
:scope => subject.scope,
|
228
|
+
:linking_profile => linking_profile_hash,
|
229
|
+
}
|
230
|
+
|
231
|
+
expect(subject.to_h).to eq(expected)
|
232
|
+
end
|
207
233
|
end
|
208
234
|
|
209
235
|
it_behaves_like 'an authorization request'
|
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.8.
|
4
|
+
version: 0.8.1
|
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:
|
12
|
+
date: 2016-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|