cronofy 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6887697315abca3647eb88c988ea0b43d9544cd7
4
- data.tar.gz: b544963a395d4e15bda4f39e5ab6b1f8cb8a6ed3
3
+ metadata.gz: 3b357138b89d6741ecd41248bf2eae6cbeb58018
4
+ data.tar.gz: dff25d78e3cf81d67732814944c48f79e54fb384
5
5
  SHA512:
6
- metadata.gz: 37ba86e3f3fd977bf469289e1108ca90dc6d72d0296c3de48c5929a4ec109d143a8e372cc64c1ffc313627713f6f0e9bc5fb1479959f9dde1ee01a09b2137fa3
7
- data.tar.gz: 9363a99117626aa73c876d99f0b14a89f3928ecbbbfa03c4c22fe42e7f3a5949660cf743551127aad93e7c295e14fd1b919b7fc0e7639809cca89d92da338684
6
+ metadata.gz: 1d5225dc72f29a5074138180e876cdf54104e9dfb22ed4128e2d39fa1a17a9b725658b23cc954689780800ebec68060fdccc667804a4426309c351635b62d035
7
+ data.tar.gz: c66f3fcccf7937fc92b43d62119ec85368c0e5d8f77287ded6f1c750a56fa52663206cd8779077d52891563a02220a88bb8dd07085ebcd50ce2237a654d53ca3
data/README.md CHANGED
@@ -23,7 +23,7 @@ bundle install
23
23
 
24
24
  In order to use the Cronofy API you will need to [create a developer account](https://app.cronofy.com/sign_up/new).
25
25
 
26
- From there you can [create personal access tokens](https://app.cronofy.com/oauth/applications/5447ae289bd94726da00000f/tokens)
26
+ From there you can [use your Calendar Sandbox](https://app.cronofy.com/oauth/sandbox)
27
27
  to access your own calendars, or you can [create an OAuth application](https://app.cronofy.com/oauth/applications/new)
28
28
  to obtain an OAuth `client_id` and `client_secret` to be able to use the full
29
29
  API.
@@ -583,6 +583,23 @@ module Cronofy
583
583
  parse_json(PermissionsResponse, "permissions_request", response)
584
584
  end
585
585
 
586
+ # Public: Lists all the resources for the service account.
587
+ #
588
+ # Returns an Array of Resources.
589
+ #
590
+ # Raises Cronofy::CredentialsMissingError if no credentials available
591
+ # or if non-service account credentials are provided.
592
+ # Raises Cronofy::AuthenticationFailureError if the access token is no
593
+ # longer valid.
594
+ # Raises Cronofy::AuthorizationFailureError if the access token does not
595
+ # include the required scope.
596
+ # Raises Cronofy::TooManyRequestsError if the request exceeds the rate
597
+ # limits for the application.
598
+ def resources
599
+ response = get("/v1/resources")
600
+ parse_collection(Resource, "resources", response)
601
+ end
602
+
586
603
  private
587
604
 
588
605
  FREE_BUSY_DEFAULT_PARAMS = { tzid: "Etc/UTC" }.freeze
data/lib/cronofy/types.rb CHANGED
@@ -196,6 +196,9 @@ module Cronofy
196
196
  class Channel < Hashie::Mash
197
197
  end
198
198
 
199
+ class Resource < Hashie::Mash
200
+ end
201
+
199
202
  class EventTime
200
203
  attr_reader :time
201
204
  attr_reader :tzid
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.12.0".freeze
2
+ VERSION = "0.13.0".freeze
3
3
  end
@@ -1020,4 +1020,37 @@ describe Cronofy::Client do
1020
1020
  end
1021
1021
  end
1022
1022
  end
1023
+
1024
+ describe 'Resources' do
1025
+ let(:request_url) { 'https://api.cronofy.com/v1/resources' }
1026
+
1027
+ describe '#resources' do
1028
+ let(:method) { :get }
1029
+
1030
+ let(:correct_response_code) { 200 }
1031
+ let(:correct_response_body) do
1032
+ {
1033
+ 'resources' => [
1034
+ {
1035
+ 'email' => 'board-room-london@example.com',
1036
+ 'name' => 'Board room (London)',
1037
+ },
1038
+ {
1039
+ 'email' => 'board-room-madrid@example.com',
1040
+ 'name' => 'Board room (Madrid)',
1041
+ }
1042
+ ]
1043
+ }
1044
+ end
1045
+
1046
+ let(:correct_mapped_result) do
1047
+ correct_response_body["resources"].map { |r| Cronofy::Resource.new(r) }
1048
+ end
1049
+
1050
+ subject { client.resources }
1051
+
1052
+ it_behaves_like 'a Cronofy request'
1053
+ it_behaves_like 'a Cronofy request with mapped return value'
1054
+ end
1055
+ end
1023
1056
  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.12.0
4
+ version: 0.13.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: 2016-08-23 00:00:00.000000000 Z
12
+ date: 2016-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.6.6
151
+ rubygems_version: 2.6.4
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Cronofy - one API for all the calendars
@@ -160,4 +160,3 @@ test_files:
160
160
  - spec/lib/cronofy/event_spec.rb
161
161
  - spec/response_parser_spec.rb
162
162
  - spec/spec_helper.rb
163
- has_rdoc: