calendlyr 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -5
- data/Gemfile +1 -5
- data/README.md +22 -18
- data/bin/console +3 -3
- data/{calendly.gemspec → calendlyr.gemspec} +3 -3
- data/lib/{calendly → calendlyr}/client.rb +6 -7
- data/lib/{calendly → calendlyr}/collection.rb +1 -1
- data/lib/{calendly → calendlyr}/error.rb +1 -1
- data/lib/{calendly → calendlyr}/object.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/event_invitees.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/event_types.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/events.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/invitations.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/memberships.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/organizations.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/scheduling_links.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/users.rb +1 -1
- data/lib/{calendly → calendlyr}/objects/webhooks.rb +1 -1
- data/lib/{calendly → calendlyr}/resource.rb +2 -2
- data/lib/{calendly → calendlyr}/resources/data_compliance.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/event_invitees.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/event_types.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/events.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/organizations.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/scheduling_links.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/users.rb +1 -1
- data/lib/{calendly → calendlyr}/resources/webhooks.rb +1 -1
- data/lib/calendlyr/version.rb +3 -0
- data/lib/calendlyr.rb +35 -0
- data/test/calendlyr/client_test.rb +8 -0
- data/test/calendlyr/object_test.rb +21 -0
- data/test/{calendly → calendlyr}/resources/data_compliance.rb +0 -0
- data/test/{calendly → calendlyr}/resources/event_invitees_test.rb +3 -3
- data/test/{calendly → calendlyr}/resources/event_types_test.rb +3 -3
- data/test/{calendly → calendlyr}/resources/events_test.rb +3 -3
- data/test/{calendly → calendlyr}/resources/organizations_test.rb +15 -15
- data/test/{calendly → calendlyr}/resources/scheduling_links.rb +0 -0
- data/test/{calendly → calendlyr}/resources/users_test.rb +9 -9
- data/test/{calendly → calendlyr}/resources/webhooks_test.rb +3 -3
- data/test/{calendly_test.rb → calendlyr_test.rb} +2 -2
- data/test/test_helper.rb +3 -3
- metadata +50 -50
- data/lib/calendly/version.rb +0 -3
- data/lib/calendly.rb +0 -35
- data/test/calendly/client_test.rb +0 -8
- data/test/calendly/object_test.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716fb90f54ab5c73f5441ccb7d8d6f8e636bceb3b3f55a6a9053fc06adabb2b0
|
4
|
+
data.tar.gz: 6bebccb4df4028bfdbad116fdef8b49768e640f4858dbb1fc7a930d98cf558f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f76039110d8ff409c573229851e4cc130772f210a769d41bb2dac8ac05679b5a9db07a1d543604dc0e2858cc8c604dac16459fcdbbbeac9e059ce91f0b7267
|
7
|
+
data.tar.gz: 5de26c0f7b9da6389918ba123935902814ce125dbd193ed50596d06c329044bb161cacb7d9ce5d0b11a032157a01f3e06d6551b2b27d0e542b964f0a5dae11c2
|
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.4]
|
6
|
+
* Renaming variables and directories Calendly to Calendlyr
|
7
|
+
|
5
8
|
## [0.3.3]
|
6
9
|
* Fix - Error when trying to send an invitation through the organization
|
7
10
|
* More testing = More coverage
|
@@ -25,8 +28,9 @@ All notable changes to this project will be documented in this file.
|
|
25
28
|
## 0.1.0
|
26
29
|
* Birthday!
|
27
30
|
|
28
|
-
[0.3.
|
29
|
-
[0.3.
|
30
|
-
[0.3.
|
31
|
-
[0.
|
32
|
-
[0.
|
31
|
+
[0.3.4]: https://github.com/araluce/calendlyr/compare/v0.3.3...v0.3.4
|
32
|
+
[0.3.3]: https://github.com/araluce/calendlyr/compare/v0.3.2...v0.3.3
|
33
|
+
[0.3.2]: https://github.com/araluce/calendlyr/compare/v0.3.0...v0.3.2
|
34
|
+
[0.3.0]: https://github.com/araluce/calendlyr/compare/v0.2.0...v0.3.0
|
35
|
+
[0.2.0]: https://github.com/araluce/calendlyr/compare/v0.1.1...v0.2.0
|
36
|
+
[0.1.1]: https://github.com/araluce/calendlyr/compare/v0.1.0...v0.1.1
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,18 +1,22 @@
|
|
1
|
-
[![](https://img.shields.io/github/license/araluce/
|
2
|
-
![](https://github.com/araluce/
|
3
|
-
[![codecov](https://codecov.io/gh/araluce/
|
4
|
-
[![
|
1
|
+
[![](https://img.shields.io/github/license/araluce/calendlyr)](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
|
2
|
+
![](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)
|
3
|
+
[![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y)](https://codecov.io/gh/araluce/calendlyr)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/calendlyr.svg)](https://badge.fury.io/rb/calendlyr)
|
5
5
|
|
6
|
-
# Calendly API Rubygem
|
6
|
+
# Calendly API Rubygem LITE version
|
7
7
|
|
8
8
|
Easy and complete rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).
|
9
9
|
|
10
|
+
No dependencies, just needed a Personal Access Token.
|
11
|
+
|
12
|
+
> If you need a Oauth authentication maybe you need [calendly-api-ruby-client](https://github.com/koshilife/calendly-api-ruby-client)
|
13
|
+
|
10
14
|
## Installation
|
11
15
|
|
12
16
|
Add this line to your application's Gemfile:
|
13
17
|
|
14
18
|
```ruby
|
15
|
-
gem 'calendlyr'
|
19
|
+
gem 'calendlyr'
|
16
20
|
```
|
17
21
|
|
18
22
|
And then execute:
|
@@ -25,10 +29,10 @@ Or install it yourself as:
|
|
25
29
|
|
26
30
|
## Usage
|
27
31
|
|
28
|
-
To access the API, you'll need to create a `
|
32
|
+
To access the API, you'll need to create a `Calendlyr::Client` and pass in your token. You can generate your Personal Access Token at [https://calendly.com/integrations/api_webhooks](https://calendly.com/integrations/api_webhooks)
|
29
33
|
|
30
34
|
```ruby
|
31
|
-
client =
|
35
|
+
client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
|
32
36
|
```
|
33
37
|
|
34
38
|
The client then gives you access to each of the resources.
|
@@ -37,7 +41,7 @@ The client then gives you access to each of the resources.
|
|
37
41
|
|
38
42
|
The gem maps as closely as we can to the Calendly API so you can easily convert API examples to gem code.
|
39
43
|
|
40
|
-
Responses are created as objects like `
|
44
|
+
Responses are created as objects like `Calendlyr::Event`. Having types like `Calendlyr::User` is handy for understanding what type of object you're working with. They're built using OpenStruct so you can easily access data in a Ruby-ish way.
|
41
45
|
|
42
46
|
##### Pagination
|
43
47
|
|
@@ -45,20 +49,20 @@ Responses are created as objects like `Calendly::Event`. Having types like `Cale
|
|
45
49
|
|
46
50
|
```ruby
|
47
51
|
results = client.me.events(count: 5)
|
48
|
-
#=>
|
52
|
+
#=> Calendlyr::Collection
|
49
53
|
|
50
54
|
results.count
|
51
55
|
#=> 5
|
52
56
|
|
53
57
|
results.data
|
54
|
-
#=> [#<
|
58
|
+
#=> [#<Calendlyr::Event>, #<Calendlyr::Event>]
|
55
59
|
|
56
60
|
results.next_page_token
|
57
61
|
#=> "KfKBetd7bS0wsFINjYky9mp8ZJXv76aL"
|
58
62
|
|
59
63
|
# Retrieve the next page
|
60
64
|
client.me.events(count: 5, next_page_token: results.next_page_token)
|
61
|
-
#=>
|
65
|
+
#=> Calendlyr::Collection
|
62
66
|
```
|
63
67
|
|
64
68
|
### Users
|
@@ -68,16 +72,16 @@ client.users.me
|
|
68
72
|
client.retrieve(user_uuid: "uuid")
|
69
73
|
|
70
74
|
client.organization
|
71
|
-
#=> #<
|
75
|
+
#=> #<Calendlyr::Organization>
|
72
76
|
|
73
77
|
client.me.event_types
|
74
|
-
#=>
|
78
|
+
#=> Calendlyr::Collection @data=[#<Calendlyr::EventType>, #<Calendlyr::EventType>]
|
75
79
|
|
76
80
|
client.me.events
|
77
|
-
#=>
|
81
|
+
#=> Calendlyr::Collection @data=[#<Calendlyr::Event>, #<Calendlyr::Event>]
|
78
82
|
|
79
83
|
client.me.memberships
|
80
|
-
#=>
|
84
|
+
#=> Calendlyr::Collection @data=[#<Calendlyr::MemberShip>, #<Calendlyr::MemberShip>]
|
81
85
|
```
|
82
86
|
|
83
87
|
### Event Types
|
@@ -146,13 +150,13 @@ client.data_compliance.delete_invitee_data
|
|
146
150
|
|
147
151
|
## Contributing
|
148
152
|
|
149
|
-
1. Fork it ( https://github.com/araluce/
|
153
|
+
1. Fork it ( https://github.com/araluce/calendlyr/fork )
|
150
154
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
151
155
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
152
156
|
4. Push to the branch (`git push origin my-new-feature`)
|
153
157
|
5. Create a new Pull Request
|
154
158
|
|
155
|
-
When adding resources, add to the list of resources in lib/
|
159
|
+
When adding resources, add to the list of resources in lib/calendlyr. Additionally, write a spec and add it to the list in the README.
|
156
160
|
|
157
161
|
## Thanks
|
158
162
|
|
data/bin/console
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
|
-
require "
|
4
|
+
require "calendlyr"
|
5
5
|
|
6
|
-
client =
|
6
|
+
client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
|
7
7
|
|
8
8
|
puts
|
9
|
-
puts "We've created a 'client' variable as a
|
9
|
+
puts "We've created a 'client' variable as a Calendlyr::Client using ENV['CALENDLY_TOKEN'] as the Personal Access Token."
|
10
10
|
puts
|
11
11
|
|
12
12
|
require "irb"
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require "./lib/
|
1
|
+
require "./lib/calendlyr/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "calendlyr"
|
5
|
-
spec.version =
|
5
|
+
spec.version = Calendlyr::VERSION
|
6
6
|
spec.authors = ["araluce"]
|
7
7
|
spec.email = ["araluce11@gmail.com"]
|
8
8
|
|
9
9
|
spec.summary = "Ruby bindings for Calendly API."
|
10
10
|
spec.description = "Ruby bindings for Calendly API. Calendly APIs can be found here: https://calendly.stoplight.io/docs/api-docs/"
|
11
|
-
spec.homepage = "https://github.com/araluce/
|
11
|
+
spec.homepage = "https://github.com/araluce/calendlyr"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -1,12 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module Calendlyr
|
2
2
|
class Client
|
3
3
|
BASE_URL = "https://api.calendly.com"
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :token
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
raise Error, "Add an api_key to use Calendly. Calendly::Client.new(api_key: 'your_api_key')" unless api_key
|
7
|
+
def initialize(token:)
|
8
|
+
@token = token
|
10
9
|
end
|
11
10
|
|
12
11
|
def me
|
@@ -49,9 +48,9 @@ module Calendly
|
|
49
48
|
DataComplianceResource.new(self)
|
50
49
|
end
|
51
50
|
|
52
|
-
# Avoid returning #<
|
51
|
+
# Avoid returning #<Calendlyr::Client @token="token" ...>
|
53
52
|
def inspect
|
54
|
-
"#<
|
53
|
+
"#<Calendlyr::Client>"
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Calendlyr
|
2
2
|
class Resource
|
3
3
|
attr_reader :client
|
4
4
|
|
@@ -42,7 +42,7 @@ module Calendly
|
|
42
42
|
|
43
43
|
request = req_type.new(uri)
|
44
44
|
request["Content-Type"] = "application/json"
|
45
|
-
request["Authorization"] = "Bearer #{client.
|
45
|
+
request["Authorization"] = "Bearer #{client.token}"
|
46
46
|
request.body = body.to_json if body.any?
|
47
47
|
|
48
48
|
http.request(request)
|
data/lib/calendlyr.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "json"
|
4
|
+
require "openssl"
|
5
|
+
require "cgi"
|
6
|
+
require "calendlyr/version"
|
7
|
+
|
8
|
+
module Calendlyr
|
9
|
+
autoload :Client, "calendlyr/client"
|
10
|
+
autoload :Collection, "calendlyr/collection"
|
11
|
+
autoload :Error, "calendlyr/error"
|
12
|
+
autoload :Resource, "calendlyr/resource"
|
13
|
+
autoload :Object, "calendlyr/object"
|
14
|
+
|
15
|
+
# High-level categories of Calendly API calls
|
16
|
+
autoload :UserResource, "calendlyr/resources/users"
|
17
|
+
autoload :EventTypeResource, "calendlyr/resources/event_types"
|
18
|
+
autoload :OrganizationResource, "calendlyr/resources/organizations"
|
19
|
+
autoload :EventResource, "calendlyr/resources/events"
|
20
|
+
autoload :EventInviteeResource, "calendlyr/resources/event_invitees"
|
21
|
+
autoload :SchedulingLinkResource, "calendlyr/resources/scheduling_links"
|
22
|
+
autoload :WebhookResource, "calendlyr/resources/webhooks"
|
23
|
+
autoload :DataComplianceResource, "calendlyr/resources/data_compliance"
|
24
|
+
|
25
|
+
# Classes used to return a nicer object wrapping the response data
|
26
|
+
autoload :User, "calendlyr/objects/users"
|
27
|
+
autoload :EventType, "calendlyr/objects/event_types"
|
28
|
+
autoload :Event, "calendlyr/objects/events"
|
29
|
+
autoload :Organization, "calendlyr/objects/organizations"
|
30
|
+
autoload :Invitation, "calendlyr/objects/invitations"
|
31
|
+
autoload :EventInvitee, "calendlyr/objects/event_invitees"
|
32
|
+
autoload :SchedulingLink, "calendlyr/objects/scheduling_links"
|
33
|
+
autoload :Membership, "calendlyr/objects/memberships"
|
34
|
+
autoload :Webhook, "calendlyr/objects/webhooks"
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ObjectTest < Minitest::Test
|
4
|
+
def test_creating_object_from_hash
|
5
|
+
assert_equal "bar", Calendlyr::Object.new(foo: "bar").foo
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_nested_hash
|
9
|
+
assert_equal "foobar", Calendlyr::Object.new(foo: {bar: {baz: "foobar"}}, client: nil).foo.bar.baz
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_nested_number
|
13
|
+
assert_equal 1, Calendlyr::Object.new(foo: {bar: 1}, client: nil).foo.bar
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_array
|
17
|
+
object = Calendlyr::Object.new(foo: [{bar: :baz}], client: nil)
|
18
|
+
assert_equal OpenStruct, object.foo.first.class
|
19
|
+
assert_equal :baz, object.foo.first.bar
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -9,8 +9,8 @@ class EventInviteesResourceTest < Minitest::Test
|
|
9
9
|
stub(path: "scheduled_events/#{event_uuid}/invitees", response: response)
|
10
10
|
event_invitees = client.event_invitees.list(event_uuid: event_uuid)
|
11
11
|
|
12
|
-
assert_equal
|
13
|
-
assert_equal
|
12
|
+
assert_equal Calendlyr::Collection, event_invitees.class
|
13
|
+
assert_equal Calendlyr::EventInvitee, event_invitees.data.first.class
|
14
14
|
assert_equal 1, event_invitees.count
|
15
15
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", event_invitees.next_page_token
|
16
16
|
end
|
@@ -22,7 +22,7 @@ class EventInviteesResourceTest < Minitest::Test
|
|
22
22
|
stub(path: "scheduled_events/#{event_uuid}/invitees/#{invitee_uuid}", response: response)
|
23
23
|
event_invitee = client.event_invitees.retrieve(event_uuid: event_uuid, invitee_uuid: invitee_uuid)
|
24
24
|
|
25
|
-
assert_equal
|
25
|
+
assert_equal Calendlyr::EventInvitee, event_invitee.class
|
26
26
|
assert_equal "https://api.calendly.com/api/v2/scheduled_events/ABCDABCDABCDABCD/invitees/ABCDABCDABCDABCD", event_invitee.uri
|
27
27
|
assert_equal "John Doe", event_invitee.name
|
28
28
|
end
|
@@ -10,8 +10,8 @@ class EventTypesResourceTest < Minitest::Test
|
|
10
10
|
stub(path: "event_types?user=#{user_uri}&organization=#{organization_uri}", response: response)
|
11
11
|
event_types = client.event_types.list(user_uri: user_uri, organization_uri: organization_uri)
|
12
12
|
|
13
|
-
assert_equal
|
14
|
-
assert_equal
|
13
|
+
assert_equal Calendlyr::Collection, event_types.class
|
14
|
+
assert_equal Calendlyr::EventType, event_types.data.first.class
|
15
15
|
assert_equal 1, event_types.count
|
16
16
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", event_types.next_page_token
|
17
17
|
end
|
@@ -22,7 +22,7 @@ class EventTypesResourceTest < Minitest::Test
|
|
22
22
|
stub(path: "event_types/#{event_type_uuid}", response: response)
|
23
23
|
event_type = client.event_types.retrieve(event_type_uuid: event_type_uuid)
|
24
24
|
|
25
|
-
assert_equal
|
25
|
+
assert_equal Calendlyr::EventType, event_type.class
|
26
26
|
assert_equal "https://api.calendly.com/event_types/AAAAAAAAAAAAAAAA", event_type.uri
|
27
27
|
assert_equal "15 Minute Meeting", event_type.name
|
28
28
|
assert_equal "acmesales", event_type.slug
|
@@ -10,8 +10,8 @@ class EventsResourceTest < Minitest::Test
|
|
10
10
|
stub(path: "scheduled_events?user=#{user_uri}&organization=#{organization_uri}", response: response)
|
11
11
|
events = client.events.list(user_uri: user_uri, organization_uri: organization_uri)
|
12
12
|
|
13
|
-
assert_equal
|
14
|
-
assert_equal
|
13
|
+
assert_equal Calendlyr::Collection, events.class
|
14
|
+
assert_equal Calendlyr::Event, events.data.first.class
|
15
15
|
assert_equal 1, events.count
|
16
16
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", events.next_page_token
|
17
17
|
end
|
@@ -22,7 +22,7 @@ class EventsResourceTest < Minitest::Test
|
|
22
22
|
stub(path: "scheduled_events/#{event_uuid}", response: response)
|
23
23
|
event = client.events.retrieve(event_uuid: event_uuid)
|
24
24
|
|
25
|
-
assert_equal
|
25
|
+
assert_equal Calendlyr::Event, event.class
|
26
26
|
assert_equal "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2", event.uri
|
27
27
|
assert_equal "15 Minute Meeting", event.name
|
28
28
|
end
|
@@ -11,7 +11,7 @@ class OrganizationsResourceTest < Minitest::Test
|
|
11
11
|
|
12
12
|
invitation = client.organizations.invite(organization_uuid: organization_uuid, email: email)
|
13
13
|
|
14
|
-
assert_equal
|
14
|
+
assert_equal Calendlyr::Invitation, invitation.class
|
15
15
|
assert_equal email, invitation.email
|
16
16
|
end
|
17
17
|
|
@@ -21,8 +21,8 @@ class OrganizationsResourceTest < Minitest::Test
|
|
21
21
|
stub(path: "organizations/#{organization_uuid}/invitations", response: response)
|
22
22
|
invitations = client.organizations.list_invitations(organization_uuid: organization_uuid)
|
23
23
|
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
24
|
+
assert_equal Calendlyr::Collection, invitations.class
|
25
|
+
assert_equal Calendlyr::Invitation, invitations.data.first.class
|
26
26
|
assert_equal 1, invitations.count
|
27
27
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", invitations.next_page_token
|
28
28
|
end
|
@@ -34,8 +34,8 @@ class OrganizationsResourceTest < Minitest::Test
|
|
34
34
|
stub(path: "organization_memberships?user=#{user_uri}&organization=#{organization_uri}", response: response)
|
35
35
|
memberships = client.organizations.list_memberships(user_uri: user_uri, organization_uri: organization_uri)
|
36
36
|
|
37
|
-
assert_equal
|
38
|
-
assert_equal
|
37
|
+
assert_equal Calendlyr::Collection, memberships.class
|
38
|
+
assert_equal Calendlyr::Membership, memberships.data.first.class
|
39
39
|
assert_equal 1, memberships.count
|
40
40
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", memberships.next_page_token
|
41
41
|
end
|
@@ -47,7 +47,7 @@ class OrganizationsResourceTest < Minitest::Test
|
|
47
47
|
stub(path: "organizations/#{organization_uuid}/invitations/#{invitation_uuid}", response: response)
|
48
48
|
invitation = client.organizations.retrieve_invitation(organization_uuid: organization_uuid, invitation_uuid: invitation_uuid)
|
49
49
|
|
50
|
-
assert_equal
|
50
|
+
assert_equal Calendlyr::Invitation, invitation.class
|
51
51
|
assert_equal "test@example.com", invitation.email
|
52
52
|
end
|
53
53
|
|
@@ -57,7 +57,7 @@ class OrganizationsResourceTest < Minitest::Test
|
|
57
57
|
stub(path: "organization_memberships/#{membership_uuid}", response: response)
|
58
58
|
membership = client.organizations.retrieve_membership(membership_uuid: membership_uuid)
|
59
59
|
|
60
|
-
assert_equal
|
60
|
+
assert_equal Calendlyr::Membership, membership.class
|
61
61
|
assert_equal "test@example.com", membership.user.email
|
62
62
|
end
|
63
63
|
|
@@ -85,7 +85,7 @@ class OrganizationsResourceTest < Minitest::Test
|
|
85
85
|
|
86
86
|
invitation = client.organization.invite_user(email: email)
|
87
87
|
|
88
|
-
assert_equal
|
88
|
+
assert_equal Calendlyr::Invitation, invitation.class
|
89
89
|
assert_equal email, invitation.email
|
90
90
|
end
|
91
91
|
|
@@ -94,8 +94,8 @@ class OrganizationsResourceTest < Minitest::Test
|
|
94
94
|
stub(path: "organizations/#{client.organization.uuid}/invitations", response: {body: fixture_file("organizations/list_invitations"), status: 200})
|
95
95
|
invitations = client.organization.list_invitations
|
96
96
|
|
97
|
-
assert_equal
|
98
|
-
assert_equal
|
97
|
+
assert_equal Calendlyr::Collection, invitations.class
|
98
|
+
assert_equal Calendlyr::Invitation, invitations.data.first.class
|
99
99
|
assert_equal 1, invitations.count
|
100
100
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", invitations.next_page_token
|
101
101
|
end
|
@@ -112,7 +112,7 @@ class OrganizationsResourceTest < Minitest::Test
|
|
112
112
|
stub(path: "organizations/#{client.organization.uuid}/invitations/AAAAAAAAAAAAAAAA", response: response)
|
113
113
|
invitation = client.organization.invitation(invitation_uuid: "AAAAAAAAAAAAAAAA")
|
114
114
|
|
115
|
-
assert_equal
|
115
|
+
assert_equal Calendlyr::Invitation, invitation.class
|
116
116
|
assert_equal "test@example.com", invitation.email
|
117
117
|
end
|
118
118
|
|
@@ -121,8 +121,8 @@ class OrganizationsResourceTest < Minitest::Test
|
|
121
121
|
stub(path: "scheduled_events?organization=#{client.organization.uri}", response: {body: fixture_file("events/list"), status: 200})
|
122
122
|
events = client.organization.events
|
123
123
|
|
124
|
-
assert_equal
|
125
|
-
assert_equal
|
124
|
+
assert_equal Calendlyr::Collection, events.class
|
125
|
+
assert_equal Calendlyr::Event, events.data.first.class
|
126
126
|
assert_equal 1, events.count
|
127
127
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", events.next_page_token
|
128
128
|
end
|
@@ -132,8 +132,8 @@ class OrganizationsResourceTest < Minitest::Test
|
|
132
132
|
stub(path: "organization_memberships?organization=#{client.organization.uri}", response: {body: fixture_file("organizations/list_memberships"), status: 200})
|
133
133
|
memberships = client.organization.memberships
|
134
134
|
|
135
|
-
assert_equal
|
136
|
-
assert_equal
|
135
|
+
assert_equal Calendlyr::Collection, memberships.class
|
136
|
+
assert_equal Calendlyr::Membership, memberships.data.first.class
|
137
137
|
assert_equal 1, memberships.count
|
138
138
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", memberships.next_page_token
|
139
139
|
end
|
File without changes
|
@@ -9,7 +9,7 @@ class UsersResourceTest < Minitest::Test
|
|
9
9
|
stub(path: "users/#{user_uuid}", response: response)
|
10
10
|
user = client.users.retrieve(user_uuid: user_uuid)
|
11
11
|
|
12
|
-
assert_equal
|
12
|
+
assert_equal Calendlyr::User, user.class
|
13
13
|
assert_equal "https://api.calendly.com/users/AAAAAAAAAAAAAAAA", user.uri
|
14
14
|
assert_equal "John Doe", user.name
|
15
15
|
assert_equal "acmesales", user.slug
|
@@ -21,7 +21,7 @@ class UsersResourceTest < Minitest::Test
|
|
21
21
|
stub(path: "users/me", response: response)
|
22
22
|
me = client.me
|
23
23
|
|
24
|
-
assert_equal
|
24
|
+
assert_equal Calendlyr::User, me.class
|
25
25
|
assert_equal "https://api.calendly.com/users/AAAAAAAAAAAAAAAA", me.uri
|
26
26
|
assert_equal "John Doe", me.name
|
27
27
|
assert_equal "acmesales", me.slug
|
@@ -33,7 +33,7 @@ class UsersResourceTest < Minitest::Test
|
|
33
33
|
stub(path: "users/me", response: response)
|
34
34
|
organization = client.organization
|
35
35
|
|
36
|
-
assert_equal
|
36
|
+
assert_equal Calendlyr::Organization, organization.class
|
37
37
|
assert_equal "https://api.calendly.com/organizations/AAAAAAAAAAAAAAAA", organization.uri
|
38
38
|
assert_equal "AAAAAAAAAAAAAAAA", organization.uuid
|
39
39
|
end
|
@@ -45,8 +45,8 @@ class UsersResourceTest < Minitest::Test
|
|
45
45
|
stub(path: "event_types?user=#{me.uri}&organization=#{me.organization.uri}", response: {body: fixture_file("event_types/list"), status: 200})
|
46
46
|
event_types = client.me.event_types
|
47
47
|
|
48
|
-
assert_equal
|
49
|
-
assert_equal
|
48
|
+
assert_equal Calendlyr::Collection, event_types.class
|
49
|
+
assert_equal Calendlyr::EventType, event_types.data.first.class
|
50
50
|
assert_equal 1, event_types.count
|
51
51
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", event_types.next_page_token
|
52
52
|
end
|
@@ -58,8 +58,8 @@ class UsersResourceTest < Minitest::Test
|
|
58
58
|
stub(path: "scheduled_events?user=#{me.uri}&organization=#{me.organization.uri}", response: {body: fixture_file("events/list"), status: 200})
|
59
59
|
events = client.me.events
|
60
60
|
|
61
|
-
assert_equal
|
62
|
-
assert_equal
|
61
|
+
assert_equal Calendlyr::Collection, events.class
|
62
|
+
assert_equal Calendlyr::Event, events.data.first.class
|
63
63
|
assert_equal 1, events.count
|
64
64
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", events.next_page_token
|
65
65
|
end
|
@@ -71,8 +71,8 @@ class UsersResourceTest < Minitest::Test
|
|
71
71
|
stub(path: "organization_memberships?user=#{me.uri}&organization=#{me.organization.uri}", response: {body: fixture_file("organizations/list_memberships"), status: 200})
|
72
72
|
memberships = client.me.memberships(organization_uri: me.organization.uri)
|
73
73
|
|
74
|
-
assert_equal
|
75
|
-
assert_equal
|
74
|
+
assert_equal Calendlyr::Collection, memberships.class
|
75
|
+
assert_equal Calendlyr::Membership, memberships.data.first.class
|
76
76
|
assert_equal 1, memberships.count
|
77
77
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", memberships.next_page_token
|
78
78
|
end
|
@@ -10,8 +10,8 @@ class WebhooksResourceTest < Minitest::Test
|
|
10
10
|
stub(path: "webhook_subscriptions?organization=#{organization_uri}&scope=#{scope}", response: response)
|
11
11
|
webhooks = client.webhooks.list(organization_uri: organization_uri, scope: scope)
|
12
12
|
|
13
|
-
assert_equal
|
14
|
-
assert_equal
|
13
|
+
assert_equal Calendlyr::Collection, webhooks.class
|
14
|
+
assert_equal Calendlyr::Webhook, webhooks.data.first.class
|
15
15
|
assert_equal 1, webhooks.count
|
16
16
|
assert_equal "sNjq4TvMDfUHEl7zHRR0k0E1PCEJWvdi", webhooks.next_page_token
|
17
17
|
end
|
@@ -29,7 +29,7 @@ class WebhooksResourceTest < Minitest::Test
|
|
29
29
|
stub(path: "webhook_subscriptions/#{webhook_uuid}", response: response)
|
30
30
|
webhook = client.webhooks.retrieve(webhook_uuid: webhook_uuid)
|
31
31
|
|
32
|
-
assert_equal
|
32
|
+
assert_equal Calendlyr::Webhook, webhook.class
|
33
33
|
assert_equal "user", webhook.scope
|
34
34
|
end
|
35
35
|
|
data/test/test_helper.rb
CHANGED
@@ -6,13 +6,13 @@ if ENV["CI"] == "true"
|
|
6
6
|
require "codecov"
|
7
7
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
8
8
|
end
|
9
|
-
require "
|
9
|
+
require "calendlyr"
|
10
10
|
require "minitest/autorun"
|
11
11
|
require "webmock/minitest"
|
12
12
|
|
13
13
|
class Minitest::Test
|
14
14
|
def client
|
15
|
-
|
15
|
+
Calendlyr::Client.new(token: "fake")
|
16
16
|
end
|
17
17
|
|
18
18
|
def fixture_file(fixture)
|
@@ -20,7 +20,7 @@ class Minitest::Test
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def stub(path:, method: :get, body: {}, response: {})
|
23
|
-
stub_req = stub_request(method, "#{
|
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
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- araluce
|
@@ -114,42 +114,42 @@ files:
|
|
114
114
|
- bin/console
|
115
115
|
- bin/setup
|
116
116
|
- bin/test
|
117
|
-
-
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
- lib/
|
139
|
-
- lib/
|
140
|
-
- lib/
|
141
|
-
- lib/
|
142
|
-
- test/
|
143
|
-
- test/
|
144
|
-
- test/
|
145
|
-
- test/
|
146
|
-
- test/
|
147
|
-
- test/
|
148
|
-
- test/
|
149
|
-
- test/
|
150
|
-
- test/
|
151
|
-
- test/
|
152
|
-
- test/
|
117
|
+
- calendlyr.gemspec
|
118
|
+
- lib/calendlyr.rb
|
119
|
+
- lib/calendlyr/client.rb
|
120
|
+
- lib/calendlyr/collection.rb
|
121
|
+
- lib/calendlyr/error.rb
|
122
|
+
- lib/calendlyr/object.rb
|
123
|
+
- lib/calendlyr/objects/event_invitees.rb
|
124
|
+
- lib/calendlyr/objects/event_types.rb
|
125
|
+
- lib/calendlyr/objects/events.rb
|
126
|
+
- lib/calendlyr/objects/invitations.rb
|
127
|
+
- lib/calendlyr/objects/memberships.rb
|
128
|
+
- lib/calendlyr/objects/organizations.rb
|
129
|
+
- lib/calendlyr/objects/scheduling_links.rb
|
130
|
+
- lib/calendlyr/objects/users.rb
|
131
|
+
- lib/calendlyr/objects/webhooks.rb
|
132
|
+
- lib/calendlyr/resource.rb
|
133
|
+
- lib/calendlyr/resources/data_compliance.rb
|
134
|
+
- lib/calendlyr/resources/event_invitees.rb
|
135
|
+
- lib/calendlyr/resources/event_types.rb
|
136
|
+
- lib/calendlyr/resources/events.rb
|
137
|
+
- lib/calendlyr/resources/organizations.rb
|
138
|
+
- lib/calendlyr/resources/scheduling_links.rb
|
139
|
+
- lib/calendlyr/resources/users.rb
|
140
|
+
- lib/calendlyr/resources/webhooks.rb
|
141
|
+
- lib/calendlyr/version.rb
|
142
|
+
- test/calendlyr/client_test.rb
|
143
|
+
- test/calendlyr/object_test.rb
|
144
|
+
- test/calendlyr/resources/data_compliance.rb
|
145
|
+
- test/calendlyr/resources/event_invitees_test.rb
|
146
|
+
- test/calendlyr/resources/event_types_test.rb
|
147
|
+
- test/calendlyr/resources/events_test.rb
|
148
|
+
- test/calendlyr/resources/organizations_test.rb
|
149
|
+
- test/calendlyr/resources/scheduling_links.rb
|
150
|
+
- test/calendlyr/resources/users_test.rb
|
151
|
+
- test/calendlyr/resources/webhooks_test.rb
|
152
|
+
- test/calendlyr_test.rb
|
153
153
|
- test/fixtures/data_compliance/delete_invitee_data.json
|
154
154
|
- test/fixtures/event_invitees/list.json
|
155
155
|
- test/fixtures/event_invitees/retrieve.json
|
@@ -171,11 +171,11 @@ files:
|
|
171
171
|
- test/fixtures/webhooks/list.json
|
172
172
|
- test/fixtures/webhooks/retrieve.json
|
173
173
|
- test/test_helper.rb
|
174
|
-
homepage: https://github.com/araluce/
|
174
|
+
homepage: https://github.com/araluce/calendlyr
|
175
175
|
licenses:
|
176
176
|
- MIT
|
177
177
|
metadata:
|
178
|
-
homepage_uri: https://github.com/araluce/
|
178
|
+
homepage_uri: https://github.com/araluce/calendlyr
|
179
179
|
post_install_message:
|
180
180
|
rdoc_options: []
|
181
181
|
require_paths:
|
@@ -196,17 +196,17 @@ signing_key:
|
|
196
196
|
specification_version: 4
|
197
197
|
summary: Ruby bindings for Calendly API.
|
198
198
|
test_files:
|
199
|
-
- test/
|
200
|
-
- test/
|
201
|
-
- test/
|
202
|
-
- test/
|
203
|
-
- test/
|
204
|
-
- test/
|
205
|
-
- test/
|
206
|
-
- test/
|
207
|
-
- test/
|
208
|
-
- test/
|
209
|
-
- test/
|
199
|
+
- test/calendlyr/client_test.rb
|
200
|
+
- test/calendlyr/object_test.rb
|
201
|
+
- test/calendlyr/resources/data_compliance.rb
|
202
|
+
- test/calendlyr/resources/event_invitees_test.rb
|
203
|
+
- test/calendlyr/resources/event_types_test.rb
|
204
|
+
- test/calendlyr/resources/events_test.rb
|
205
|
+
- test/calendlyr/resources/organizations_test.rb
|
206
|
+
- test/calendlyr/resources/scheduling_links.rb
|
207
|
+
- test/calendlyr/resources/users_test.rb
|
208
|
+
- test/calendlyr/resources/webhooks_test.rb
|
209
|
+
- test/calendlyr_test.rb
|
210
210
|
- test/fixtures/data_compliance/delete_invitee_data.json
|
211
211
|
- test/fixtures/event_invitees/list.json
|
212
212
|
- test/fixtures/event_invitees/retrieve.json
|
data/lib/calendly/version.rb
DELETED
data/lib/calendly.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require "net/http"
|
2
|
-
require "uri"
|
3
|
-
require "json"
|
4
|
-
require "openssl"
|
5
|
-
require "cgi"
|
6
|
-
require "calendly/version"
|
7
|
-
|
8
|
-
module Calendly
|
9
|
-
autoload :Client, "calendly/client"
|
10
|
-
autoload :Collection, "calendly/collection"
|
11
|
-
autoload :Error, "calendly/error"
|
12
|
-
autoload :Resource, "calendly/resource"
|
13
|
-
autoload :Object, "calendly/object"
|
14
|
-
|
15
|
-
# High-level categories of Calendly API calls
|
16
|
-
autoload :UserResource, "calendly/resources/users"
|
17
|
-
autoload :EventTypeResource, "calendly/resources/event_types"
|
18
|
-
autoload :OrganizationResource, "calendly/resources/organizations"
|
19
|
-
autoload :EventResource, "calendly/resources/events"
|
20
|
-
autoload :EventInviteeResource, "calendly/resources/event_invitees"
|
21
|
-
autoload :SchedulingLinkResource, "calendly/resources/scheduling_links"
|
22
|
-
autoload :WebhookResource, "calendly/resources/webhooks"
|
23
|
-
autoload :DataComplianceResource, "calendly/resources/data_compliance"
|
24
|
-
|
25
|
-
# Classes used to return a nicer object wrapping the response data
|
26
|
-
autoload :User, "calendly/objects/users"
|
27
|
-
autoload :EventType, "calendly/objects/event_types"
|
28
|
-
autoload :Event, "calendly/objects/events"
|
29
|
-
autoload :Organization, "calendly/objects/organizations"
|
30
|
-
autoload :Invitation, "calendly/objects/invitations"
|
31
|
-
autoload :EventInvitee, "calendly/objects/event_invitees"
|
32
|
-
autoload :SchedulingLink, "calendly/objects/scheduling_links"
|
33
|
-
autoload :Membership, "calendly/objects/memberships"
|
34
|
-
autoload :Webhook, "calendly/objects/webhooks"
|
35
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ObjectTest < Minitest::Test
|
4
|
-
def test_creating_object_from_hash
|
5
|
-
assert_equal "bar", Calendly::Object.new(foo: "bar").foo
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_nested_hash
|
9
|
-
assert_equal "foobar", Calendly::Object.new(foo: {bar: {baz: "foobar"}}, client: nil).foo.bar.baz
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_nested_number
|
13
|
-
assert_equal 1, Calendly::Object.new(foo: {bar: 1}, client: nil).foo.bar
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_array
|
17
|
-
object = Calendly::Object.new(foo: [{bar: :baz}], client: nil)
|
18
|
-
assert_equal OpenStruct, object.foo.first.class
|
19
|
-
assert_equal :baz, object.foo.first.bar
|
20
|
-
end
|
21
|
-
end
|