Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching new Features #9

Merged
merged 11 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 66 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
[![](https://img.shields.io/github/license/araluce/calendlyr)](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
[![](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)](https://github.com/araluce/calendlyr/actions)
[![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y)](https://codecov.io/gh/araluce/calendlyr)
![example workflow](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg)
[![Gem Version](https://badge.fury.io/rb/calendlyr.svg)](https://badge.fury.io/rb/calendlyr)

# Calendly API Rubygem LITE version
# Calendly API Rubygem

Easy and complete rubygem for [Calendly](https://calendly.com/). Currently supports [API v2](https://calendly.stoplight.io/docs/api-docs).

Just needed a Personal Access Token.

> If you need a Oauth authentication maybe you need [calendly-api-ruby-client](https://github.com/koshilife/calendly-api-ruby-client)

## Dependencies

No dependencies :tada:
Expand All @@ -19,87 +18,76 @@ We know about the importance of not add dependencies that you don't want.

## 📚 Docs

* [Installation](docs/1_installation.md)
* [Usage](docs/2_usage.md)
* **Resources**
* [Pagination](/docs/resources/1_pagination.md)
* **Availability**
* [UserBusyTime](/docs/resources/availability/1_user_busy_time.md)
* [UserAvailabilitySchedule](/docs/resources/availability/2_user_availability_schedule.md)
* [Data Compliance](/docs/resources/2_data_compliance.md)
* [User](/docs/resources/user.md)

### Event Types
````ruby
client.event_types.list user_uri: "user_uri", organization_uri: "organization_uri"
client.event_types.retrieve event_type_uuid: "id"
````

### Events
````ruby
client.events.list user_uri: "user_uri", organization_uri: "organization_uri"
client.events.retrieve event_uuid: "event_uuid"
````

### Event Invitees
````ruby
client.event_invitees.list event_uuid: "event_uuid"
client.event_invitees.retrieve event_uuid: "event_uuid", invitee_uuid: "invitee_uuid"
````

### Scheduling Links
````ruby
client.scheduling_links.create owner_uri: "owner_uri", max_event_count: 1, owner_type: "EventType"
````

### Organizations
````ruby
# Create invitation
client.organizations.invite(organization_uuid: "organization_uuid", email: "[email protected]")
client.organization.invite(email: "[email protected]")
# List invitations
client.organizations.list_invitations(organization_uuid: "organization_uuid")
client.organization.list_invitations
# Get invitation
client.organizations.retrieve_invitation(organization_uuid: "organization_uuid", invitation_uuid: "invitation_uuid")
client.organization.invitation(invitation_uuid: "invitation_uuid")
# Revoke invitation
client.organizations.revoke_invitation(organization_uuid: "organization_uuid", invitation_uuid: "organization_uuid")
client.organization.revoke_invitation(invitation_uuid: "organization_uuid")
invitation = client.organization.invitation(invitation_uuid: "invitation_uuid")
invitation.revoke

# List memberships
client.organizations.list_memberships
client.organization.memberships
# Get membership
client.organizations.retrieve_membership(membership_uuid: "membership_uuid")
# Remove membership
client.organizations.remove_user(membership_uuid: "membership_uuid")

client.organization.events

# List/Creaete webhooks
client.organization.list_webhooks(scope: "scope")
client.organization.create_webhook(url: "post_callback_url", events: ["invitee.canceled", "invitee.created"], scope: "scope")

# List activity log
client.organization.activity_log
````

### Webhooks
### Installation

Add this line to your application's Gemfile:

```ruby
client.webhooks.list(organization_uri: "organization_uri", scope: "scope")
client.webhooks.create(url: "post_callback_url", events: ["invitee.canceled", "invitee.created"], organization_uri: "organization_uri", scope: "scope")
client.webhooks.retrieve(webhook_uuid: "webhook_uuid")
client.webhooks.delete(webhook_uuid: "webhook_uuid")
gem 'calendlyr'
```

### Data Compliance
And then execute:

$ bundle

Or install it yourself as:

$ gem install calendlyr

### Usage

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)

```ruby
client.data_compliance.delete_invitee_data
client = Calendlyr::Client.new(token: ENV["CALENDLY_TOKEN"])
```

The client then gives you access to each of the resources.


### Resources

The gem maps as closely as we can to the Calendly API so you can easily convert API examples to gem code.

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.

* [Pagination](docs/resources/pagination.md)
* **Activity Log**
* [Calendlyr::ActivityLog](docs/resources/activity_log/list_activity_log_entries.md)
* **Availabilities**
* [Calendlyr::Availabilities::Rule](docs/resources/availabilities/availability_rule.md)
* [Calendlyr::Availabilities::UserSchedule](docs/resources/availabilities/user_availability_schedule.md)
* [Calendlyr::Availabilities::UserBusyTime](docs/resources/availabilities/user_busy_time.md)
* [Data Compliance](docs/resources/data_compliance.md)
* **Event Types**
* [Calendlyr::EventType](docs/resources/event_types/event_type.md)
* [Calendlyr::EventTypes::AvailableTime](docs/resources/event_types/available_time.md)
* [Calendlyr::EventTypes::Membership](docs/resources/event_types/membership.md)
* [Calendlyr::EventTypes::Profile](docs/resources/event_types/profile.md)
* **Groups**
* [Calendlyr::Group](docs/resources/groups/group.md)
* [Calendlyr::Groups::Relationship](docs/resources/groups/relationship.md)
* **Organizations**
* [Calendlyr::Organization](docs/resources/organizations/organization.md)
* [Calendlyr::Organizations::Invitation](docs/resources/organizations/invitation.md)
* [Calendlyr::Organizations::Membership](docs/resources/organizations/membership.md)
* **Routing Forms**
* [Calendlyr::RoutingForm](docs/resources/routing_forms/routing_form.md)
* [Calendlyr::RoutingForms::Submission](docs/resources/routing_forms/submission.md)
* **Schedule Events**
* [Calendlyr::Event](docs/resources/events/event.md)
* [Calendlyr::Events::Cancellation](docs/resources/events/cancellation.md)
* [Calendlyr::Events::Guest](docs/resources/events/guest.md)
* [Calendlyr::Events::Invitee](docs/resources/events/invitee.md)
* [Calendlyr::Events::InviteeNoShow](docs/resources/events/invitee_no_show.md)
* [Scheduled Links](docs/resources/scheduling_link.md)
* [Shares](docs/resources/share.md)
* [Users](docs/resources/user.md)
* **Webhooks**
* [Calendlyr::Webhooks::Subscription](docs/resources/webhooks/subscription.md)
* [Calendlyr::Webhooks::Payload](docs/resources/webhooks/payload.md)
* [Calendlyr::Webhooks::InviteePayload](docs/resources/webhooks/invitee_payload.md)

## Contributing

1. Fork it ( https://github.com/araluce/calendlyr/fork )
Expand Down
21 changes: 0 additions & 21 deletions docs/1_installation.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/2_usage.md

This file was deleted.

9 changes: 0 additions & 9 deletions docs/3_resources.md

This file was deleted.

34 changes: 34 additions & 0 deletions docs/resources/activity_log/list_activity_log_entries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# List Activity Log Entries Calendlyr::ActivityLog

This endpoint requires an Enterprise subscription.

## Client requests

### List

Returns a list of activity log entries

Visit official [API Doc](https://developer.calendly.com/api-docs/d37c7f031f339-list-activity-log-entries)

For the example bellow we will use only required parameters, but you can use any other parameter as well.

```ruby
client.organizations.activity_log(organization: `organization_uri`)
#=> #<Calendlyr::Collection @data=[#<Calendlyr::ActivityLog, ...], @client=#<Calendlyr::Client>>
```

## Object methods

### Associated Organization

```ruby
user_busy_time.associated_organization
#=> #<Calendlyr::Organization>
```

### Associated Actor

```ruby
user_busy_time.associated_actor
#=> #<Calendlyr::User>
```
5 changes: 5 additions & 0 deletions docs/resources/availabilities/availability_rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Availability Rule Calendlyr::Availabilities::Rule

The rules for an availability schedule.

Visit official [API Doc](https://developer.calendly.com/api-docs/3546c792f5695-availability-rule)
50 changes: 50 additions & 0 deletions docs/resources/availabilities/user_availability_schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# User Availability Schedule Calendlyr::Availabilities::UserSchedule

The availability schedule set by the user.

Visit official [API Doc](https://developer.calendly.com/api-docs/008bd39518269-user-availability-schedule)

## Client requests

### Retrieve

This will return the availability schedule of the given UUID.See [official API doc](https://developer.calendly.com/api-docs/3b1c2d5f97b5c-get-user-availability-schedule)

```ruby
client.availabilities.retrieve_user_schedule(uuid: @uuid)
#=> #<Calendlyr::Availabilities::UserSchedule uri="https://api.calendly.com/user_availability_schedule/abc123", default=true, name="Working Hours", user="https://api.calendly.com/users/abc123", timezone="America/New_York", rules=[#<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="09:30">], wday="sunday", date="2022-12-31">], client=#<Calendlyr::Client>, uuid="abc123">
```

### List

Return the availability schedules of the given user. See [official API doc](https://developer.calendly.com/api-docs/8098de44af94c-list-user-availability-schedules)

```ruby
client.availabilities.list_user_schedules(user: @user)
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Availabilities::UserSchedule uri="https://api.calendly.com/user_availability_schedule/abc123", default=true, name="Working Hours", user="https://api.calendly.com/users/abc123", timezone="America/New_York", rules=[#<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="09:30">], wday="sunday", date="2022-12-31">], client=#<Calendlyr::Client>, uuid="abc123">, #<Calendlyr::Availabilities::UserSchedule uri="https://api.calendly.com/user_availability_schedule/abc456", default=false, name="Evening Hours", user="https://api.calendly.com/users/abc123", timezone="America/New_York", rules=[#<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="monday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="tuesday">, #<OpenStruct type="wday", intervals=[], wday="wednesday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="thursday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="friday">, #<OpenStruct type="wday", intervals=[], wday="saturday">, #<OpenStruct type="date", intervals=[#<OpenStruct from="08:30", to="09:30">], date="2028-12-31">], client=#<Calendlyr::Client>, uuid="abc456">], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
```

#### List on me

Use `me` user

```ruby
client.me.availability_schedules
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Availabilities::UserSchedule uri="https://api.calendly.com/user_availability_schedule/abc123", default=true, name="Working Hours", user="https://api.calendly.com/users/abc123", timezone="America/New_York", rules=[#<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="09:30">], wday="sunday", date="2022-12-31">], client=#<Calendlyr::Client>, uuid="abc123">, #<Calendlyr::Availabilities::UserSchedule uri="https://api.calendly.com/user_availability_schedule/abc456", default=false, name="Evening Hours", user="https://api.calendly.com/users/abc123", timezone="America/New_York", rules=[#<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="monday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="tuesday">, #<OpenStruct type="wday", intervals=[], wday="wednesday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="thursday">, #<OpenStruct type="wday", intervals=[#<OpenStruct from="08:30", to="17:00">], wday="friday">, #<OpenStruct type="wday", intervals=[], wday="saturday">, #<OpenStruct type="date", intervals=[#<OpenStruct from="08:30", to="09:30">], date="2028-12-31">], client=#<Calendlyr::Client>, uuid="abc456">], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
```

## Object methods

### Associated User

```ruby
user_schedule.associated_user
#=> #<Calendlyr::User>
```

### Associated Rules

```ruby
user_schedule.rules
#=> [#<Calendlyr::Availabilities::Rule>, ...]
```
28 changes: 28 additions & 0 deletions docs/resources/availabilities/user_busy_time.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# User Busy Time Calendlyr::Availabilities::UserBusyTime

An internal or external scheduled event for a given user.

Visit official [API Doc](https://developer.calendly.com/api-docs/acae53ca17454-user-busy-time)

## Client requests

### List

Visit official [API Doc](https://developer.calendly.com/api-docs/5920076156501-list-user-busy-times)

Date range can be no greater than 1 week (7 days).

For the example bellow we will use only required parameters, but you can use any other parameter as well.
```ruby
client.availabilities.list_user_busy_times(user: `user_uri`, start_time: `start_time`, end_time: `end_time`)
#=> #<Calendlyr::Collection @data=[#<Calendlyr::Availabilities::UserBusyTime type="calendly", start_time="2020-01-02T20:00:00.000000Z", end_time="2020-01-02T20:30:00.000000Z", buffered_start_time="2020-01-02T19:30:00.000000Z", buffered_end_time="2020-01-02T21:00:00.000000Z", event=#<OpenStruct uri="https://api.calendly.com/scheduled_events/abc123">, client=#<Calendlyr::Client>, uuid=nil>, #<Calendlyr::UserBusyTime type="calendly", start_time="2020-01-05T20:00:00.000000Z", end_time="2020-01-05T20:30:00.000000Z", buffered_start_time="2020-01-05T19:30:00.000000Z", buffered_end_time="2020-01-05T21:00:00.000000Z", event=#<OpenStruct uri="https://api.calendly.com/scheduled_events/abc12345">, client=#<Calendlyr::Client>, uuid=nil>, #<Calendlyr::UserBusyTime type="external", start_time="2020-01-07T20:00:00.000000Z", end_time="2020-01-07T20:30:00.000000Z", client=#<Calendlyr::Client>, uuid=nil>], @count=nil, @next_page=nil, @next_page_token=nil, @client=#<Calendlyr::Client>>
```

## Object methods

### Associated Event

```ruby
user_busy_time.associated_event
#=> #<Calendlyr::Event>
```
18 changes: 0 additions & 18 deletions docs/resources/availability/1_user_busy_time.md

This file was deleted.

Loading