calendly 0.1.3 → 0.2.0

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
  SHA256:
3
- metadata.gz: 73fe04308ea6b80fec0d5141f3a848476d0b4dd0e818cc32019ab54f9ad02243
4
- data.tar.gz: 2adaee2381b6631af1d19eb07d0fa122b1cd8d347c877c07808bac5cb3670d6e
3
+ metadata.gz: 21eb586917df0301bac9cc14ee37b00f9d2e6775c4980778e8bf6f0194f19c2b
4
+ data.tar.gz: '0846561057ab9fba60c3e4e20bb141b387f1e75924ed29e8ee5f661f269d2a27'
5
5
  SHA512:
6
- metadata.gz: 3a3b7a7dc8926ea80d87e9a3cc5b96a4c6816b78baebeac4d28773eba80ad6078c44ea379e01d0be87ecd47bc8f12eef4d64516a67b7e11adc2a5e843aacc9a7
7
- data.tar.gz: bf1eb06ab1432c27b7d557cd4c703a6d157ce26f526942a89f3102b34c9d8ba6b3e123d78b5e7ca53348e49125be7e2e3423da7f68540c799745b7b2c35d8c3b
6
+ metadata.gz: d8436df1c0240bdaf1891feb514bd12aa48d7ba8f24dde0c8687e193b178e74f21a0cb9536b7cca778ede6369b76c5db1510d5db403931a79a2f5760400a6f75
7
+ data.tar.gz: 011512ae26dda34a724b7ff31e05ea8d2bcc6e2e3750be397953ab435b9f2e42ae556d27b0427075cd686a3ba1ce34d355aa4739869c0b1a8a0eda1bcd75b6ec
@@ -1,9 +1,12 @@
1
-
2
1
  # CHANGELOG
3
2
 
3
+ ## 0.2.0
4
+
5
+ - save fetched data in cache. (refs #14)
6
+
4
7
  ## 0.1.3
5
8
 
6
- - support webhook APIs
9
+ - support webhook APIs (refs #9)
7
10
  - `GET /webhook_subscriptions`
8
11
  - `GET /webhook_subscriptions/{webhook_uuid}`
9
12
  - `POST /webhook_subscriptions`
@@ -59,11 +59,21 @@ module Calendly
59
59
  # @raise [Calendly::ApiError] if the api returns error code.
60
60
  # @since 0.0.1
61
61
  def current_user
62
- user
62
+ return @cached_current_user if @cached_current_user
63
+
64
+ @cached_current_user = user
63
65
  end
64
66
 
65
67
  alias me current_user
66
68
 
69
+ # @since 0.2.0
70
+ def current_user!
71
+ @cached_current_user = nil
72
+ current_user
73
+ end
74
+
75
+ alias me! current_user!
76
+
67
77
  #
68
78
  # Get basic information about a user
69
79
  #
@@ -79,8 +79,16 @@ module Calendly
79
79
  # @raise [Calendly::ApiError] if the api returns error code.
80
80
  # @since 0.1.0
81
81
  def invitees(opts = {})
82
+ return @cached_invitees if @cached_invitees
83
+
82
84
  request_proc = proc { |options| client.event_invitees uuid, options }
83
- auto_pagination request_proc, opts
85
+ @cached_invitees = auto_pagination request_proc, opts
86
+ end
87
+
88
+ # @since 0.2.0
89
+ def invitees!(opts = {})
90
+ @cached_invitees = nil
91
+ invitees opts
84
92
  end
85
93
 
86
94
  private
@@ -25,8 +25,16 @@ module Calendly
25
25
  # @raise [Calendly::ApiError] if the api returns error code.
26
26
  # @since 0.1.0
27
27
  def memberships(opts = {})
28
+ return @cached_memberships if @cached_memberships
29
+
28
30
  request_proc = proc { |options| client.memberships uri, options }
29
- auto_pagination request_proc, opts
31
+ @cached_memberships = auto_pagination request_proc, opts
32
+ end
33
+
34
+ # @since 0.2.0
35
+ def memberships!(opts = {})
36
+ @cached_memberships = nil
37
+ memberships opts
30
38
  end
31
39
 
32
40
  #
@@ -44,8 +52,16 @@ module Calendly
44
52
  # @raise [Calendly::ApiError] if the api returns error code.
45
53
  # @since 0.1.0
46
54
  def invitations(opts = {})
55
+ return @cached_invitations if @cached_invitations
56
+
47
57
  request_proc = proc { |options| client.invitations uuid, options }
48
- auto_pagination request_proc, opts
58
+ @cached_invitations = auto_pagination request_proc, opts
59
+ end
60
+
61
+ # @since 0.2.0
62
+ def invitations!(opts = {})
63
+ @cached_invitations = nil
64
+ invitations opts
49
65
  end
50
66
 
51
67
  #
@@ -74,8 +90,16 @@ module Calendly
74
90
  # @raise [Calendly::ApiError] if the api returns error code.
75
91
  # @since 0.1.3
76
92
  def webhooks(opts = {})
93
+ return @cached_webhooks if @cached_webhooks
94
+
77
95
  request_proc = proc { |options| client.webhooks uri, options }
78
- auto_pagination request_proc, opts
96
+ @cached_webhooks = auto_pagination request_proc, opts
97
+ end
98
+
99
+ # @since 0.2.0
100
+ def webhooks!(opts = {})
101
+ @cached_webhooks = nil
102
+ webhooks opts
79
103
  end
80
104
 
81
105
  #
@@ -67,10 +67,18 @@ module Calendly
67
67
  # @raise [Calendly::ApiError] if the api returns error code.
68
68
  # @since 0.1.3
69
69
  def user_scope_webhooks(opts = {})
70
+ return @cached_user_scope_webhooks if @cached_user_scope_webhooks
71
+
70
72
  org_uri = organization.uri if organization
71
73
  user_uri = user.uri if user
72
74
  request_proc = proc { |options| client.user_scope_webhooks org_uri, user_uri, options }
73
- auto_pagination request_proc, opts
75
+ @cached_user_scope_webhooks = auto_pagination request_proc, opts
76
+ end
77
+
78
+ # @since 0.2.0
79
+ def user_scope_webhooks!(opts = {})
80
+ @cached_user_scope_webhooks = nil
81
+ user_scope_webhooks opts
74
82
  end
75
83
 
76
84
  #
@@ -57,8 +57,16 @@ module Calendly
57
57
  # @raise [Calendly::Error] if the uri is empty.
58
58
  # @since 0.1.0
59
59
  def organization_membership
60
+ return @cached_organization_membership if @cached_organization_membership
61
+
60
62
  mems, = client.memberships_by_user uri
61
- mems.first
63
+ @cached_organization_membership = mems.first
64
+ end
65
+
66
+ # @since 0.2.0
67
+ def organization_membership!
68
+ @cached_organization_membership = nil
69
+ organization_membership
62
70
  end
63
71
 
64
72
  #
@@ -74,8 +82,16 @@ module Calendly
74
82
  # @raise [Calendly::ApiError] if the api returns error code.
75
83
  # @since 0.1.0
76
84
  def event_types(opts = {})
85
+ return @cached_event_types if @cached_event_types
86
+
77
87
  request_proc = proc { |options| client.event_types uri, options }
78
- auto_pagination request_proc, opts
88
+ @cached_event_types = auto_pagination request_proc, opts
89
+ end
90
+
91
+ # @since 0.2.0
92
+ def event_types!(opts = {})
93
+ @cached_event_types = nil
94
+ event_types opts
79
95
  end
80
96
 
81
97
  #
@@ -95,8 +111,16 @@ module Calendly
95
111
  # @raise [Calendly::ApiError] if the api returns error code.
96
112
  # @since 0.1.0
97
113
  def scheduled_events(opts = {})
114
+ return @cached_scheduled_events if @cached_scheduled_events
115
+
98
116
  request_proc = proc { |options| client.scheduled_events uri, options }
99
- auto_pagination request_proc, opts
117
+ @cached_scheduled_events = auto_pagination request_proc, opts
118
+ end
119
+
120
+ # @since 0.2.0
121
+ def scheduled_events!(opts = {})
122
+ @cached_scheduled_events = nil
123
+ scheduled_events opts
100
124
  end
101
125
  end
102
126
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Calendly
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -168,7 +168,7 @@ metadata:
168
168
  homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
169
169
  source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
170
170
  changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
171
- documentation_uri: https://www.rubydoc.info/gems/calendly/0.1.3
171
+ documentation_uri: https://www.rubydoc.info/gems/calendly/0.2.0
172
172
  post_install_message:
173
173
  rdoc_options: []
174
174
  require_paths: