calendlyr 0.3.5 → 0.3.6
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/.github/workflows/ci.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +15 -2
- data/lib/calendlyr/client.rb +3 -2
- data/lib/calendlyr/version.rb +1 -1
- data/test/calendlyr/resources/users_test.rb +16 -0
- data/test/fixtures/users/reload.json +14 -0
- data/test/test_helper.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e53e19c9a9bcc92787f9fe776a53e64668eb13939ff7cddb8ebc42220a2346f2
|
4
|
+
data.tar.gz: 3a36e15c5c436c852edbf69d177e147b3bf7615a0a5bec93e7a257947df39f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86a6982263871804c661e3f2b554d3d49d253835f4faebac93c6acdcc4538078ba7dd77d837e8e5f8533cf9ae22da05b813c445ea8e90e903e1269a6e138cc5
|
7
|
+
data.tar.gz: af2ab8a21873283cdd588267a7c39ba2699e949bb829c15a6a66f61672ad496e69b776ed93849a667cf34e73ab62b1b7eaa7e005165710eca87e9bb5721348b4
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [0.3.6]
|
6
|
+
* User caching
|
7
|
+
|
5
8
|
## [0.3.4]
|
6
9
|
* Renaming variables and directories Calendly to Calendlyr
|
7
10
|
|
@@ -28,6 +31,7 @@ All notable changes to this project will be documented in this file.
|
|
28
31
|
## 0.1.0
|
29
32
|
* Birthday!
|
30
33
|
|
34
|
+
[0.3.6]: https://github.com/araluce/calendlyr/compare/v0.3.4...v0.3.6
|
31
35
|
[0.3.4]: https://github.com/araluce/calendlyr/compare/v0.3.3...v0.3.4
|
32
36
|
[0.3.3]: https://github.com/araluce/calendlyr/compare/v0.3.2...v0.3.3
|
33
37
|
[0.3.2]: https://github.com/araluce/calendlyr/compare/v0.3.0...v0.3.2
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
|
2
|
-

|
2
|
+
[](https://github.com/araluce/calendlyr/actions)
|
3
3
|
[](https://codecov.io/gh/araluce/calendlyr)
|
4
4
|
[](https://badge.fury.io/rb/calendlyr)
|
5
5
|
|
@@ -84,6 +84,17 @@ client.me.memberships
|
|
84
84
|
#=> Calendlyr::Collection @data=[#<Calendlyr::MemberShip>, #<Calendlyr::MemberShip>]
|
85
85
|
```
|
86
86
|
|
87
|
+
#### Me (Cached)
|
88
|
+
|
89
|
+
Probably you need to make many calls through `client.me`, so we decided to not make calls for every `client.me` reference by caching it the first time. However, if you need to reload the content of `me` you can `force_relaod` to force a new call.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
client.me # makes a call and caches the response
|
93
|
+
client.me # no call, value cached
|
94
|
+
client.me(force_reload: true) # makes a new call and update cache value
|
95
|
+
```
|
96
|
+
|
97
|
+
|
87
98
|
### Event Types
|
88
99
|
````ruby
|
89
100
|
client.event_types.list user_uri: "user_uri", organization_uri: "organization_uri"
|
@@ -118,7 +129,7 @@ client.organization.list_invitations
|
|
118
129
|
# Get invitation
|
119
130
|
client.organizations.retrieve_invitation(organization_uuid: "organization_uuid", invitation_uuid: "invitation_uuid")
|
120
131
|
client.organization.invitation(invitation_uuid: "invitation_uuid")
|
121
|
-
#Revoke invitation
|
132
|
+
# Revoke invitation
|
122
133
|
client.organizations.revoke_invitation(organization_uuid: "organization_uuid", invitation_uuid: "organization_uuid")
|
123
134
|
client.organization.revoke_invitation(invitation_uuid: "organization_uuid")
|
124
135
|
invitation = client.organization.invitation(invitation_uuid: "invitation_uuid")
|
@@ -160,4 +171,6 @@ When adding resources, add to the list of resources in lib/calendlyr. Additional
|
|
160
171
|
|
161
172
|
## Thanks
|
162
173
|
|
174
|
+
Many thanks [@markets](https://github.com/markets) for all comments, details and tips for this rubygem project and for made me grow professionally in my day by day :raised_hands:
|
175
|
+
|
163
176
|
Thanks [@excid3](https://github.com/excid3) and his [Vultr.rb](https://github.com/excid3/vultr.rb) rubygem project.
|
data/lib/calendlyr/client.rb
CHANGED
data/lib/calendlyr/version.rb
CHANGED
@@ -28,6 +28,22 @@ class UsersResourceTest < Minitest::Test
|
|
28
28
|
assert_equal "test@example.com", me.email
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_me_caching
|
32
|
+
response = {body: fixture_file("users/retrieve"), status: 200}
|
33
|
+
stub = stub(path: "users/me", response: response)
|
34
|
+
me = client.me
|
35
|
+
remove_request_stub(stub)
|
36
|
+
assert_equal client.me, me
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_me_caching_reload
|
40
|
+
stub(path: "users/me", response: {body: fixture_file("users/retrieve"), status: 200})
|
41
|
+
me = client.me
|
42
|
+
stub(path: "users/me", response: {body: fixture_file("users/reload"), status: 200})
|
43
|
+
reloaded_me = client.me(force_reload: true)
|
44
|
+
assert me.name != reloaded_me.name
|
45
|
+
end
|
46
|
+
|
31
47
|
def test_organization
|
32
48
|
response = {body: fixture_file("users/retrieve"), status: 200}
|
33
49
|
stub(path: "users/me", response: response)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"resource": {
|
3
|
+
"uri": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
|
4
|
+
"name": "John Doe Reloaded",
|
5
|
+
"slug": "acmesales",
|
6
|
+
"email": "test@example.com",
|
7
|
+
"scheduling_url": "https://calendly.com/acmesales",
|
8
|
+
"timezone": "America/New York",
|
9
|
+
"avatar_url": "https://01234567890.cloudfront.net/uploads/user/avatar/0123456/a1b2c3d4.png",
|
10
|
+
"created_at": "2019-01-02T03:04:05.678Z",
|
11
|
+
"updated_at": "2019-08-07T06:05:04.321Z",
|
12
|
+
"current_organization": "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA"
|
13
|
+
}
|
14
|
+
}
|
data/test/test_helper.rb
CHANGED
@@ -12,7 +12,7 @@ require "webmock/minitest"
|
|
12
12
|
|
13
13
|
class Minitest::Test
|
14
14
|
def client
|
15
|
-
Calendlyr::Client.new(token: "fake")
|
15
|
+
@client ||= Calendlyr::Client.new(token: "fake")
|
16
16
|
end
|
17
17
|
|
18
18
|
def fixture_file(fixture)
|
@@ -23,5 +23,6 @@ class Minitest::Test
|
|
23
23
|
stub_req = stub_request(method, "#{Calendlyr::Client::BASE_URL}/#{path}")
|
24
24
|
stub_req.with(body: body) if [:post, :put, :patch].include?(method)
|
25
25
|
stub_req.to_return(**response)
|
26
|
+
stub_req
|
26
27
|
end
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calendlyr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- araluce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- test/fixtures/organizations/retrieve_membership.json
|
166
166
|
- test/fixtures/organizations/revoke_invitation.json
|
167
167
|
- test/fixtures/scheduling_links/create.json
|
168
|
+
- test/fixtures/users/reload.json
|
168
169
|
- test/fixtures/users/retrieve.json
|
169
170
|
- test/fixtures/webhooks/create.json
|
170
171
|
- test/fixtures/webhooks/delete.json
|
@@ -222,6 +223,7 @@ test_files:
|
|
222
223
|
- test/fixtures/organizations/retrieve_membership.json
|
223
224
|
- test/fixtures/organizations/revoke_invitation.json
|
224
225
|
- test/fixtures/scheduling_links/create.json
|
226
|
+
- test/fixtures/users/reload.json
|
225
227
|
- test/fixtures/users/retrieve.json
|
226
228
|
- test/fixtures/webhooks/create.json
|
227
229
|
- test/fixtures/webhooks/delete.json
|