cronofy 0.4.0 → 0.4.1
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 -3
- data/lib/cronofy/types.rb +3 -0
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/client_spec.rb +38 -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: faf650d1168f4a567cbc49a9e31017eb1d276dc2
|
4
|
+
data.tar.gz: cdb6ea741023aa6e013f7c8329bc7f89f9eb706c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68168edb3e805f71e4fd52665263dcea1cb73b2d5e616eb17bd1fa32939ed36cba4791406a1a5e0035d02ab708e6034cdf511910ddd058a57eb35758858b0346
|
7
|
+
data.tar.gz: 02094852e2efe96b0af2af176cdb8810d9dc3b4d08c21c232f45f3cbaa70f5fb3afbd0fde4bd5f43a80c745be5337bc23a1d24aeb5504f2ad2a8e51bb64aeab1
|
data/lib/cronofy/client.rb
CHANGED
@@ -5,7 +5,6 @@ module Cronofy
|
|
5
5
|
# caller.
|
6
6
|
DEFAULT_OAUTH_SCOPE = %w{
|
7
7
|
read_account
|
8
|
-
list_calendars
|
9
8
|
read_events
|
10
9
|
create_event
|
11
10
|
delete_event
|
@@ -42,8 +41,6 @@ module Cronofy
|
|
42
41
|
# Raises Cronofy::CredentialsMissingError if no credentials available.
|
43
42
|
# Raises Cronofy::AuthenticationFailureError if the access token is no
|
44
43
|
# longer valid.
|
45
|
-
# Raises Cronofy::AuthorizationFailureError if the access token does not
|
46
|
-
# include the required scope.
|
47
44
|
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
48
45
|
# limits for the application.
|
49
46
|
def list_calendars
|
@@ -288,6 +285,22 @@ module Cronofy
|
|
288
285
|
parse_json(Account, "account", response)
|
289
286
|
end
|
290
287
|
|
288
|
+
# Public: Lists all the profiles for the account.
|
289
|
+
#
|
290
|
+
# See https://www.cronofy.com/developers/api/alpha/#profiles for reference.
|
291
|
+
#
|
292
|
+
# Returns an Array of Profiles
|
293
|
+
#
|
294
|
+
# Raises Cronofy::CredentialsMissingError if no credentials available.
|
295
|
+
# Raises Cronofy::AuthenticationFailureError if the access token is no
|
296
|
+
# longer valid.
|
297
|
+
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
298
|
+
# limits for the application.
|
299
|
+
def list_profiles
|
300
|
+
response = get("/v1/profiles")
|
301
|
+
parse_collection(Profile, "profiles", response)
|
302
|
+
end
|
303
|
+
|
291
304
|
# Public: Generates a URL to send the user to in order to perform the OAuth
|
292
305
|
# 2.0 authorization process.
|
293
306
|
#
|
data/lib/cronofy/types.rb
CHANGED
data/lib/cronofy/version.rb
CHANGED
@@ -555,4 +555,42 @@ describe Cronofy::Client do
|
|
555
555
|
it_behaves_like "a Cronofy request with mapped return value"
|
556
556
|
end
|
557
557
|
end
|
558
|
+
|
559
|
+
describe 'Profiles' do
|
560
|
+
let(:request_url) { 'https://api.cronofy.com/v1/profiles' }
|
561
|
+
|
562
|
+
describe '#profiles' do
|
563
|
+
let(:method) { :get }
|
564
|
+
|
565
|
+
let(:correct_response_code) { 200 }
|
566
|
+
let(:correct_response_body) do
|
567
|
+
{
|
568
|
+
'profiles' => [
|
569
|
+
{
|
570
|
+
'provider_name' => 'google',
|
571
|
+
'profile_id' => 'pro_n23kjnwrw2',
|
572
|
+
'profile_name' => 'example@cronofy.com',
|
573
|
+
'profile_connected' => true,
|
574
|
+
},
|
575
|
+
{
|
576
|
+
'provider_name' => 'apple',
|
577
|
+
'profile_id' => 'pro_n23kjnwrw2',
|
578
|
+
'profile_name' => 'example@cronofy.com',
|
579
|
+
'profile_connected' => false,
|
580
|
+
'profile_relink_url' => 'http =>//to.cronofy.com/RaNggYu',
|
581
|
+
},
|
582
|
+
]
|
583
|
+
}
|
584
|
+
end
|
585
|
+
|
586
|
+
let(:correct_mapped_result) do
|
587
|
+
correct_response_body["profiles"].map { |pro| Cronofy::Profile.new(pro) }
|
588
|
+
end
|
589
|
+
|
590
|
+
subject { client.list_profiles }
|
591
|
+
|
592
|
+
it_behaves_like 'a Cronofy request'
|
593
|
+
it_behaves_like 'a Cronofy request with mapped return value'
|
594
|
+
end
|
595
|
+
end
|
558
596
|
end
|
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.
|
4
|
+
version: 0.4.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: 2015-
|
12
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|