calendly 0.5.1 → 0.5.2

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: 707a9cda35428975745f73c6c9b714bda1ec4bfd769f3b21cd66cf53e45e5eee
4
- data.tar.gz: 8d249367bc1d6ffe766adf653f624ca4d15cf7c8fa4a51cca1a2329f3cbfbdeb
3
+ metadata.gz: 987260a701999245159a34a38b587e873a80272a3391b5909339c7b6cd01994a
4
+ data.tar.gz: bb1b11aba44dcfca555b97887611cc989921a972263ea071e1ec144cac7d2bf6
5
5
  SHA512:
6
- metadata.gz: 7685bb924251ccdaa0b93e4b95e43bd4ede147d2029ca83f1b2af1eff9f21e13a64b7acb88c5f63e1e8cfd84bcec8ba61fadbc7f577eaeb52e144ffa50fb4243
7
- data.tar.gz: e01999d2785ebbe123ab08e63689a509ddf595433efa35b621c1d4e6bcdc94dea0b6df3fc87e2260147036cc9a85a85023c8c24e3bc6c8cd186cda16afcec92b
6
+ metadata.gz: 62d40c515e6833f34ef591b8b2a2a8089970951f6eae3fb68190388de58919a67c16851426f11c0c7c2b06bbc89f9de5248223ed2bd0d4b45fe45c11c0e232d7
7
+ data.tar.gz: 58136d311993b7b3a1e352888eba6756c7235476078934f2b8e893f06a29af33e36cefd3bdb751d8540948953c1cfdd145c1e160779cad2d3c554eff3f1ccc31
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.2
4
+
5
+ - started to support a API
6
+ - `POST /scheduling_links`
7
+
3
8
  ## 0.5.1
4
9
 
5
10
  - added method EventType#fetch
@@ -512,7 +512,7 @@ module Calendly
512
512
  else
513
513
  params[:scope] = 'organization'
514
514
  end
515
- body = request(:post, 'webhook_subscriptions', body: params)
515
+ body = request :post, 'webhook_subscriptions', body: params
516
516
  WebhookSubscription.new body[:resource], self
517
517
  end
518
518
 
@@ -530,11 +530,42 @@ module Calendly
530
530
  true
531
531
  end
532
532
 
533
+ #
534
+ # Create a scheduling link.
535
+ #
536
+ # @param [String] uri A link to the resource that owns this scheduling Link.
537
+ # @param [String] max_event_count The max number of events that can be scheduled using this scheduling link.
538
+ # @param [String] resource_type Resource type.
539
+ # @return [Hash]
540
+ # e.g.
541
+ # {
542
+ # booking_url: "https://calendly.com/s/FOO-BAR-SLUG",
543
+ # owner: "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
544
+ # owner_type: "EventType"
545
+ # }
546
+ # @raise [Calendly::Error] if the uri arg is empty.
547
+ # @raise [Calendly::Error] if the max_event_count arg is empty.
548
+ # @raise [Calendly::Error] if the resource_type arg is empty.
549
+ # @raise [Calendly::ApiError] if the api returns error code.
550
+ # @since 0.5.2
551
+ def create_schedule_link(uri, max_event_count = 1, resource_type: 'EventType')
552
+ check_not_empty uri, 'uri'
553
+ check_not_empty max_event_count, 'max_event_count'
554
+ check_not_empty resource_type, 'resource_type'
555
+ params = {
556
+ max_event_count: max_event_count,
557
+ owner: uri,
558
+ owner_type: resource_type
559
+ }
560
+ body = request :post, 'scheduling_links', body: params
561
+ body[:resource]
562
+ end
563
+
533
564
  private
534
565
 
535
566
  def request(method, path, params: nil, body: nil)
536
567
  debug_log "Request #{method.to_s.upcase} #{API_HOST}/#{path} params:#{params}, body:#{body}"
537
- res = access_token.request(method, path, params: params, body: body)
568
+ res = access_token.request method, path, params: params, body: body
538
569
  debug_log "Response status:#{res.status}, body:#{res.body}"
539
570
  parse_as_json res
540
571
  rescue OAuth2::Error => e
@@ -86,6 +86,25 @@ module Calendly
86
86
  client.event_type uuid
87
87
  end
88
88
 
89
+ #
90
+ # Create an associated scheduling link.
91
+ #
92
+ # @param [String] max_event_count The max number of events that can be scheduled using this scheduling link.
93
+ # @return [Hash]
94
+ # e.g.
95
+ # {
96
+ # booking_url: "https://calendly.com/s/FOO-BAR-SLUG",
97
+ # owner: "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
98
+ # owner_type: "EventType"
99
+ # }
100
+ # @raise [Calendly::Error] if the uri is empty.
101
+ # @raise [Calendly::Error] if the max_event_count arg is empty.
102
+ # @raise [Calendly::ApiError] if the api returns error code.
103
+ # @since 0.5.2
104
+ def create_schedule_link(max_event_count = 1)
105
+ client.create_schedule_link uri, max_event_count, resource_type: 'EventType'
106
+ end
107
+
89
108
  private
90
109
 
91
110
  def after_set_attributes(attrs)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Calendly
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
@@ -154,7 +154,7 @@ metadata:
154
154
  homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
155
155
  source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
156
156
  changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
157
- documentation_uri: https://www.rubydoc.info/gems/calendly/0.5.1
157
+ documentation_uri: https://www.rubydoc.info/gems/calendly/0.5.2
158
158
  post_install_message:
159
159
  rdoc_options: []
160
160
  require_paths: