toc_doc 1.9.0 → 1.10.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: 72ce333b7f46666dc6109150032a053014153937a65f89d629d1a686216d52b3
4
- data.tar.gz: 064462c8ae43a562a07b5e4f9f36aff3dc1b37f15444f3e912b04b61ce2e506d
3
+ metadata.gz: '00208a866b7839fb071bd5fb6fee43f80ef13500a27f5b5abe3080c18b1adf09'
4
+ data.tar.gz: ab2ea6b3d4341e4c0168677e43fd1e6fbe9cf84ff3a9dbce6614c355eaae298e
5
5
  SHA512:
6
- metadata.gz: b5750b8a84a14ba7a9144ead48313f8db74829de9f4bddaf58930ebaf1606400dc4cff0a1110cbb587999b22bf0efff490beaa3710fc21c96dbd402d4068c069
7
- data.tar.gz: 563244b90ad4a8418d7348e88bb1c408955285574a2a5d7efbcac02c9e311b70410f868fbd4777b63a163ce90f525075361ec457b3618537a44ccce133fd33e4
6
+ metadata.gz: 2d2e0f1a82a5b177374b559e5164ab5c7e190f5a7f43d213d5050d534ca76c444537d8715482d6360af3bbd4d2a3b7d406a1c6c2d30baaaa1e27350008f934f4
7
+ data.tar.gz: 1fb9f0f22c644d0ebdf31382f8318633b402dc6797b0be40a94c05e569169b1cb5b94514f1dc558d89ec3e242472f9770f3721d188eb98935280bbfb59909516
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.10.0] - 2026-04-07
4
+
5
+ ### Added
6
+
7
+ - **`TocDoc::Availability::Collection#booking_url`** — new method returning the Doctolib booking URL for a given availability; accepts an `availability` argument and delegates URL construction to `TocDoc::UriUtils`
8
+
3
9
  ## [1.9.0] - 2026-04-06
4
10
 
5
11
  ### Added
data/CODE_OF_CONDUCT.md CHANGED
@@ -6,5 +6,3 @@
6
6
  * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
7
  * When interpreting the words and actions of others, participants should always assume good intentions.
8
8
  * Behaviour which can be reasonably considered harassment will not be tolerated.
9
-
10
- If you have any concerns about behaviour within this project, please contact us at ["m.louguet@gmail.com"](mailto:"m.louguet@gmail.com").
data/README.md CHANGED
@@ -140,7 +140,7 @@ client.get('/availabilities.json', query: { visit_motive_ids: '123', agenda_ids:
140
140
  | Option | Default | Description |
141
141
  |---|---|---|
142
142
  | `api_endpoint` | `https://www.doctolib.fr` | Base URL. Change to `.de` / `.it` for other countries. |
143
- | `user_agent` | `TocDoc Ruby Gem 1.8.0` | `User-Agent` header sent with every request. |
143
+ | `user_agent` | `TocDoc Ruby Gem 1.10.0` | `User-Agent` header sent with every request. |
144
144
  | `default_media_type` | `application/json` | `Accept` and `Content-Type` headers. |
145
145
  | `per_page` | `15` | Default number of availability dates per request (capped at `15`). Emits a warning if the value exceeds the cap. |
146
146
  | `connect_timeout` | `5` | TCP connect timeout in seconds, passed to Faraday as `open_timeout`. Override via `TOCDOC_CONNECT_TIMEOUT`. |
@@ -312,6 +312,7 @@ Implements `Enumerable`, yielding `TocDoc::Availability` instances that have at
312
312
  | `#raw_availabilities` | `Array<TocDoc::Availability>` | All date entries, including those with no slots. |
313
313
  | `#more?` | `Boolean` | `true` when the API has indicated further pages exist (`next_slot` is present). |
314
314
  | `#load_next!` | `self` | Fetches the next window and merges it into this collection. Raises `StopIteration` when `#more?` is `false`. Requires a client (i.e. built via `Availability.where`). |
315
+ | `#booking_url(availability)` | `String` | Returns the Doctolib booking URL for a given `TocDoc::Availability` instance. Delegates URL construction to `TocDoc::UriUtils`. |
315
316
  | `#to_h` | `Hash` | Plain-hash representation (only dates with slots in the `availabilities` key). |
316
317
 
317
318
  ### `TocDoc::Availability`
data/TODO.md CHANGED
@@ -27,6 +27,16 @@
27
27
 
28
28
  # DONE & RELEASED
29
29
 
30
+ ## 1.10
31
+
32
+ - [x] `Collection#booking_url` — Doctolib booking URL
33
+
34
+ ## 1.9
35
+
36
+ - [x] `Collection#availabilities` / `#all` — filtered entries with memoization, invalidated by `#merge_page!`
37
+ - [x] `Collection#slots` — all slots across the collection
38
+ - [x] `Collection#load_next!` — renamed from `#fetch_next_page` for idiomatic mutation signalling
39
+
30
40
  ## 1.8
31
41
 
32
42
  - [x] Configurable availability pagination depth + `Collection#more?` / `#fetch_next_page`
@@ -4,5 +4,5 @@ module TocDoc
4
4
  # The current version of the TocDoc gem.
5
5
  #
6
6
  # @return [String]
7
- VERSION = '1.9.0'
7
+ VERSION = '1.10.0'
8
8
  end
@@ -144,6 +144,35 @@ module TocDoc
144
144
  @availabilities = nil
145
145
  self
146
146
  end
147
+
148
+ # Builds a Doctolib booking URL for the current query context.
149
+ #
150
+ # Requires +booking_slug+ to have been passed as an option to
151
+ # {TocDoc::Availability.where}. Returns +nil+ when absent.
152
+ #
153
+ # The URL targets the motive-selection step of the booking funnel,
154
+ # pre-filled with the first practice ID and the visit motive IDs from
155
+ # the original query.
156
+ #
157
+ # @return [String, nil] fully-qualified booking URL, or +nil+ if
158
+ # +booking_slug+ was not provided
159
+ #
160
+ # @example
161
+ # collection = TocDoc::Availability.where(
162
+ # visit_motive_ids: 1830057,
163
+ # agenda_ids: 2359638,
164
+ # booking_slug: 'dentiste/bordeaux/jane-doe'
165
+ # )
166
+ # collection.booking_url
167
+ # #=> "https://www.doctolib.fr/dentiste/bordeaux/jane-doe/booking/motives?pid=practice-125055&vmids[]=1830057"
168
+ def booking_url
169
+ return unless @query[:booking_slug]
170
+
171
+ practice_id = [@query[:practice_ids]].flatten.first
172
+ "#{TocDoc.api_endpoint}/#{@query[:booking_slug]}/booking/motives" \
173
+ "?pid=practice-#{practice_id}" \
174
+ "&vmids[]=#{@query[:visit_motive_ids]}"
175
+ end
147
176
  end
148
177
  end
149
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toc_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 01max