cronofy 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87327b745d5c41ca1cb19a4058f895095d0bd13b
4
- data.tar.gz: b5a255411695294ec9b97eb855d1109f36dd3e23
3
+ metadata.gz: faf650d1168f4a567cbc49a9e31017eb1d276dc2
4
+ data.tar.gz: cdb6ea741023aa6e013f7c8329bc7f89f9eb706c
5
5
  SHA512:
6
- metadata.gz: b4236b61a9a7874dda9f09be63c83dc432487331159ab6030953fe650e0af8f9c488d9bdb77ecf5658c4dece165730e3b99737538ead79edd56e50ef0b21346e
7
- data.tar.gz: 2df716944fb437daf393892d68cb0bcbdaaaaf61b13a09e39113c324580e821db56fdbe507797eb5e5678acbfda3b5d2e8f0899771419c3a85662b7efbfd8f3a
6
+ metadata.gz: 68168edb3e805f71e4fd52665263dcea1cb73b2d5e616eb17bd1fa32939ed36cba4791406a1a5e0035d02ab708e6034cdf511910ddd058a57eb35758858b0346
7
+ data.tar.gz: 02094852e2efe96b0af2af176cdb8810d9dc3b4d08c21c232f45f3cbaa70f5fb3afbd0fde4bd5f43a80c745be5337bc23a1d24aeb5504f2ad2a8e51bb64aeab1
@@ -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
@@ -144,4 +144,7 @@ module Cronofy
144
144
 
145
145
  coerce_key :events, Array[Event]
146
146
  end
147
+
148
+ class Profile < Hashie::Mash
149
+ end
147
150
  end
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
@@ -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.0
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-07-30 00:00:00.000000000 Z
12
+ date: 2015-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2