toc_doc 1.0.0 → 1.1.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: 3637aae8586b1ea3b5b568a4ef64a295b3e3664ada7d252163e8176ce429aa37
4
- data.tar.gz: da283d2f5efd9c37b7f6b20d6bc207dcb79f826850b8d7d0953157473f36345f
3
+ metadata.gz: 31301e5ab8d81e4a073f6a86da51671dd7d41673eff44b48373659831b971010
4
+ data.tar.gz: e308514b6009f7b703d8861e739d963ea0048ed930778329bd453b1f28f1e82c
5
5
  SHA512:
6
- metadata.gz: 79a3d614929d14b5709dec397ab39a78c07db2db0e31da2e2de7423af8da4a1af5b5dbc77f3943da8b104ab25b85531328e739697384fb7a8a53451320bf9951
7
- data.tar.gz: 962d1c35bb6ede7899491b93e0f00c868a3aa87ffe4a32b076576b0017d96ff09e3214eb37000bee0ba40f43269597c75d21daf18c77e92787b39d61b29b4696
6
+ metadata.gz: c8936171d0c8228e3a1390ef3d164ab5ca08cccecb656087cc983d61c859eaed3153d63715e4fd6f4bcd3f6b62cea4c85c1a6410669925ef3c73185f550eb28b
7
+ data.tar.gz: 23ad7e64604e97d9c18a0b99b8917af0b97974f2c67d1dc842d16070650a3e97ef79e0902d96f4dd4f8e71f84bdc30d09811aa16fb61342bbdcacb6e7979b8fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2026-03-06
4
+
5
+ ### Changed
6
+
7
+ - **`TocDoc::Availability`** — `#date` now returns a parsed `Date` object instead of a raw string; `#slots` now returns an array of `DateTime` objects instead of strings
8
+ - **`TocDoc::Response::Availability#next_slot`** — falls back to inferring the next slot from the first available slot when the API response omits the `next_slot` key
9
+
10
+ ### Removed
11
+
12
+ - **VCR** — removed VCR dependency from the test suite; HTTP interactions are now stubbed directly with WebMock
13
+
3
14
  ## [1.0.0] - 2026-03-04
4
15
 
5
16
  ### Added
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  A Ruby gem for interacting with the (unofficial) Doctolib API. A thin, Faraday-based client with modular resource endpoints, configurable defaults, optional auto-pagination, and a clean error hierarchy.
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/toc_doc.svg)](https://badge.fury.io/rb/toc_doc)
6
+ [![CI](https://github.com/01max/toc_doc/actions/workflows/main.yml/badge.svg)](https://github.com/01max/toc_doc/actions)
7
+ [![Coverage Status](https://coveralls.io/repos/github/01max/toc_doc/badge.svg?branch=main)](https://coveralls.io/github/01max/toc_doc?branch=main)
8
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
9
+ [![YARD Docs](https://img.shields.io/badge/docs-YARD-blue.svg)](https://rubydoc.info/gems/toc_doc)
10
+
5
11
  > **Heads-up:** Doctolib™ does not publish a public API. This gem reverse-engineers
6
12
  > the endpoints used by the Doctolib™ website. Behaviour may change at any time
7
13
  > without notice. This project is for entertainment purposes only.
@@ -71,7 +77,7 @@ response.total # => 5
71
77
  response.next_slot # => "2026-02-28T10:00:00.000+01:00"
72
78
 
73
79
  response.availabilities.each do |avail|
74
- puts "#{avail.date}: #{avail.slots.join(', ')}"
80
+ puts "#{avail.date}: #{avail.slots.map { |s| s.strftime('%H:%M') }.join(', ')}"
75
81
  end
76
82
  ```
77
83
 
@@ -189,8 +195,8 @@ Each element of `Response::Availability#availabilities`.
189
195
 
190
196
  | Method | Type | Description |
191
197
  |---|---|---|
192
- | `#date` | `String` | Date in `YYYY-MM-DD` format. |
193
- | `#slots` | `Array<String>` | ISO 8601 datetimes for each bookable slot on that date. |
198
+ | `#date` | `Date` | Parsed date object. |
199
+ | `#slots` | `Array<DateTime>` | Parsed datetime objects for each bookable slot on that date. |
194
200
  | `#to_h` | `Hash` | Plain-hash representation. |
195
201
 
196
202
  **Example:**
@@ -201,8 +207,8 @@ response = TocDoc.availabilities(visit_motive_ids: 123, agenda_ids: 456)
201
207
  response.total # => 5
202
208
  response.next_slot # => "2026-02-28T10:00:00.000+01:00"
203
209
 
204
- response.availabilities.first.date # => "2026-02-28"
205
- response.availabilities.first.slots # => ["2026-02-28T10:00:00.000+01:00", ...]
210
+ response.availabilities.first.date # => #<Date: 2026-02-28>
211
+ response.availabilities.first.slots # => [#<DateTime: 2026-02-28T10:00:00+01:00>, ...]
206
212
 
207
213
  response.to_h
208
214
  # => {
data/TODO.md CHANGED
@@ -1,77 +1,108 @@
1
- # 1.0
1
+ # PLAN
2
2
 
3
- ## 1 – Skeleton & Tooling
3
+ ### Extra Endpoints
4
+ - [x] Identify additional endpoints
5
+ - [ ] Prioritize implementation of resource modules for those endpoints
6
+
7
+ ## 1.2
8
+
9
+ ### Better API usage
10
+ - [ ] Rate limiting
11
+ - [ ] Caching
12
+ - [ ] Logging
13
+
14
+ ## 1.4
15
+
16
+ ### Auth / User-based actions
17
+ - [ ] Research auth scheme
18
+ - [ ] Authentication module + headers
19
+ - [ ] Auth specs
20
+
21
+ # Potential Endpoints
22
+
23
+ - Interesting JSONs [GET]
24
+ - Practitioner ?
25
+ - https://www.doctolib.fr/pharmacie/paris/pharmacie-faidherbe.json
26
+ - https://www.doctolib.fr/dentiste/bordeaux/mathilde-devun-lesparre-medoc.json
27
+ - https://www.doctolib.fr/a/b/mathilde-devun-lesparre-medoc.json
28
+ - https://www.doctolib.fr/profiles/mathilde-devun-lesparre-medoc.json
29
+ - Rassemblement practiciens / Place Practitioners collection
30
+ - https://www.doctolib.fr/profiles/pavillon-de-la-mutualite-bordeaux-rue-vital-carles.json
31
+ - Places
32
+ - https://www.doctolib.fr/patient_app/place_autocomplete.json?query=47300
33
+ - Interesting NON JSONs
34
+ - City practitioners (❗️JSON-LD in a script tag of an HTML page - data-id="removable-json-ld")
35
+ - https://www.doctolib.fr/dentiste/bordeaux/
36
+ - https://www.doctolib.fr/medecin-generaliste/bordeaux/
37
+ - https://www.doctolib.fr/medecin-generaliste/villeneuve-sur-lot
38
+ - Non-interesting
39
+ - Legal links
40
+ - https://www.doctolib.fr/search/footer_legal_links.json
41
+ - FAQ
42
+ - https://www.doctolib.fr/search/footer_public_content.json?hub_search=false&display_faq=true&speciality_id=2&place_id=18733
43
+ - Social media links
44
+ - https://www.doctolib.fr/search/footer_social_media_links.json
45
+ - New Booking [POST]
46
+ - online_booking/draft/new.json
47
+
48
+ # DONE & RELEASED
49
+
50
+ ## 1.0
51
+
52
+ ### 1 – Skeleton & Tooling
4
53
  - [x] Scaffold gem & layout
5
54
  - [x] Gem spec metadata & deps
6
55
  - [x] Lib structure (default/config/client/etc.)
7
56
  - [x] CI workflow (RSpec + RuboCop)
8
57
  - [x] RSpec + WebMock + VCR setup
9
58
 
10
- ## 2 – Configuration
59
+ ### 2 – Configuration
11
60
  - [x] Default options & ENV fallbacks
12
61
  - [x] Configurable module (keys, reset, options)
13
62
  - [x] Top-level TocDoc wiring (client, setup, delegation)
14
63
  - [x] Config specs (module + client)
15
64
 
16
- ## 3 – Connection & HTTP
65
+ ### 3 – Connection & HTTP
17
66
  - [x] Connection module (agent, request helpers)
18
67
  - [x] ~Faraday middleware~
19
68
  - [x] URL building helpers
20
69
  - [x] Connection specs
21
70
 
22
- ## 4 – Error Handling
71
+ ### 4 – Error Handling
23
72
  - [x] Error base class & factory
24
73
  - [x] Error subclasses (4xx/5xx)
25
74
  - [x] RaiseError middleware
26
75
  - [x] Error mapping specs
27
76
 
28
- ## 5 – Client & Availabilities
77
+ ### 5 – Client & Availabilities
29
78
  - [x] Client includes config + connection
30
79
  - [x] Availabilities endpoint module
31
80
  - [x] TocDoc.availabilities delegation
32
81
  - [x] Availabilities specs (stubs/VCR)
33
82
 
34
- ## 6 – Response Objects
83
+ ### 6 – Response Objects
35
84
  - [x] Resource wrapper
36
85
  - [x] Availability objects
37
86
  - [x] Client mapping to response objects
38
87
  - [x] Response specs
39
88
 
40
- ## 8 – Pagination
89
+ ### 8 – Pagination
41
90
  - [x] Analyze pagination model
42
91
  - [x] Implement Connection#paginate
43
92
  - [x] Pagination config & specs
44
93
 
45
- ## 9 – Docs & Release
94
+ ### 9 – Docs & Release
46
95
  - [x] README
47
96
  - [x] YARD docs
48
97
  - [x] CHANGELOG
49
98
  - [x] FIX GH CI
50
- - [ ] Build & publish gem
51
- - [ ] on rubygem
52
- - [ ] gem.coop ?
53
-
54
- # 1.1
99
+ - [x] Build & publish gem
100
+ - [x] on rubygem
101
+ - [x] release on GH
102
+ - [x] gem.coop/@maxime
103
+ - [x] Add test coverage tool
55
104
 
56
- ## Parse raw API data
57
- - [ ] Parse date / datetime
58
- - [ ] ?
105
+ ## 1.1
59
106
 
60
- ## Better API usage
61
- - [ ] Rate limiting
62
- - [ ] Caching
63
- - [ ] Logging
64
- - [ ] Better multi-region support ?
65
- - [ ] Async support ?
66
-
67
- ## Extra Endpoints
68
- - [ ] Identify additional endpoints
69
- - [ ] Implement resource modules
70
- - [ ] Specs per endpoint
71
-
72
- # 1.2
73
-
74
- ## Auth / User-based actions
75
- - [ ] Research auth scheme
76
- - [ ] Authentication module + headers
77
- - [ ] Auth specs
107
+ ### Parse raw API data
108
+ - [x] Parse date / datetime
@@ -4,5 +4,5 @@ module TocDoc
4
4
  # The current version of the TocDoc gem.
5
5
  #
6
6
  # @return [String]
7
- VERSION = '1.0.0'
7
+ VERSION = '1.1.0'
8
8
  end
@@ -1,21 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'date'
4
+
3
5
  module TocDoc
4
6
  # Represents a single availability date entry returned by the Doctolib API.
5
7
  #
6
8
  # @example
7
9
  # avail = TocDoc::Availability.new('date' => '2026-02-28', 'slots' => ['2026-02-28T10:00:00.000+01:00'])
8
- # avail.date #=> "2026-02-28"
9
- # avail.slots #=> ["2026-02-28T10:00:00.000+01:00"]
10
+ # avail.date #=> #<Date: 2026-02-28>
11
+ # avail.raw_date #=> "2026-02-28"
12
+ # avail.slots #=> [#<DateTime: 2026-02-28T10:00:00.000+01:00>]
13
+ # avail.raw_slots #=> ["2026-02-28T10:00:00.000+01:00"]
10
14
  class Availability < Resource
11
- # @return [String] date in ISO 8601 format (e.g. "2026-02-28")
12
- def date
13
- @attrs['date']
15
+ attr_reader :date, :slots
16
+
17
+ # @param attrs [Hash] raw attributes from the API response, expected to include
18
+ def initialize(*attrs)
19
+ super
20
+ raw = build_raw(@attrs)
21
+
22
+ @date = Date.parse(raw['date']) if raw['date']
23
+ @slots = raw['slots'].map { |s| DateTime.parse(s) }
14
24
  end
15
25
 
16
- # @return [Array<String>] ISO 8601 datetime strings for each available slot
17
- def slots
18
- @attrs['slots'] || []
26
+ private
27
+
28
+ def build_raw(attrs)
29
+ {
30
+ 'date' => attrs['date'],
31
+ 'slots' => attrs['slots'] || []
32
+ }
19
33
  end
20
34
  end
21
35
  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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 01max
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: '2.0'
46
46
  description: |-
47
47
  A standalone Ruby gem providing a Faraday-based client
48
- with modular resource endpoints, configurable defaults, and a clean error hierarchy.
48
+ to interact with the (unofficial) Doctolib API.
49
49
  email:
50
50
  - m.louguet@gmail.com
51
51
  executables: []
@@ -82,7 +82,6 @@ homepage: https://github.com/01max/toc_doc
82
82
  licenses:
83
83
  - GPL-3.0-or-later
84
84
  metadata:
85
- allowed_push_host: https://rubygems.org
86
85
  homepage_uri: https://github.com/01max/toc_doc
87
86
  source_code_uri: https://github.com/01max/toc_doc/tree/main
88
87
  changelog_uri: https://github.com/01max/toc_doc/blob/main/CHANGELOG.md