provet-client 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/brakeman.yml +29 -0
  3. data/.github/workflows/rspec.yml +29 -0
  4. data/.github/workflows/rubocop.yml +36 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +34 -0
  7. data/CHANGELOG.md +53 -0
  8. data/CODE_OF_CONDUCT.md +84 -0
  9. data/Gemfile +15 -0
  10. data/Gemfile.lock +88 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +184 -0
  13. data/Rakefile +8 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/lib/provet.rb +83 -0
  17. data/lib/provet/appointment.rb +23 -0
  18. data/lib/provet/availability.rb +13 -0
  19. data/lib/provet/base.rb +135 -0
  20. data/lib/provet/client.rb +15 -0
  21. data/lib/provet/consultation.rb +23 -0
  22. data/lib/provet/consultation_discharge_instruction.rb +19 -0
  23. data/lib/provet/consultation_item.rb +23 -0
  24. data/lib/provet/consultation_item_template.rb +23 -0
  25. data/lib/provet/department.rb +23 -0
  26. data/lib/provet/invoice.rb +19 -0
  27. data/lib/provet/invoice_row.rb +23 -0
  28. data/lib/provet/item.rb +19 -0
  29. data/lib/provet/item_list.rb +23 -0
  30. data/lib/provet/item_template.rb +11 -0
  31. data/lib/provet/item_template_item.rb +15 -0
  32. data/lib/provet/laboratory_analysis_group.rb +11 -0
  33. data/lib/provet/patient.rb +15 -0
  34. data/lib/provet/phone_number.rb +11 -0
  35. data/lib/provet/reason.rb +15 -0
  36. data/lib/provet/reason_group.rb +11 -0
  37. data/lib/provet/reminder.rb +11 -0
  38. data/lib/provet/reminder_template.rb +11 -0
  39. data/lib/provet/shift.rb +11 -0
  40. data/lib/provet/shift_type.rb +23 -0
  41. data/lib/provet/user.rb +27 -0
  42. data/lib/provet/user_details.rb +11 -0
  43. data/lib/provet/user_group.rb +23 -0
  44. data/lib/provet/vat_group.rb +23 -0
  45. data/lib/provet/version.rb +5 -0
  46. data/provet-client.gemspec +27 -0
  47. metadata +105 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c278a83033212409b47a291afb714b5578e46aba0ababa53ff12d5bfa87eaee4
4
+ data.tar.gz: 98809902bf79c8123e96e5f7f75f40adb102abbdf2ebdefae256eac4ac364241
5
+ SHA512:
6
+ metadata.gz: fa63a9ab58d78364c4303caad1eb08870cbd6e9c769c76515d9e90cc871e41360df97bb382807de73a071dcba9d41f896f9765618925f1db6e988df713d9c0d7
7
+ data.tar.gz: f98c8bc633691fcd964d8fed5b6d0f0b93047806a2211579a9cd014274c3e114bc14df3071d0e383fdf1b08a7791aec972d99d72b0037c52eeada3f10857c4e7
@@ -0,0 +1,29 @@
1
+ name: Brakeman
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['2.6']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
+ # uses: ruby/setup-ruby@v1
23
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+
28
+ - name: Run tests
29
+ run: bundle exec brakeman --force --exit-on-warn --output brakeman.html
@@ -0,0 +1,29 @@
1
+ name: Rspec
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['2.6']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
+ # uses: ruby/setup-ruby@v1
23
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+
28
+ - name: Run tests
29
+ run: bundle exec rspec
@@ -0,0 +1,36 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Rubocop
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+
35
+ - name: Run tests
36
+ run: bundle exec rubocop
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
6
+ AllCops:
7
+ NewCops: enable
8
+ TargetRubyVersion: 2.4
9
+
10
+ Layout/LineLength:
11
+ Exclude:
12
+ - spec/**/*
13
+
14
+ Lint/MissingSuper:
15
+ Enabled: false
16
+
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - spec/**/*
20
+
21
+ RSpec/ExampleLength:
22
+ Enabled: false
23
+
24
+ RSpec/MessageSpies:
25
+ Enabled: false
26
+
27
+ RSpec/MultipleExpectations:
28
+ Enabled: false
29
+
30
+ Style/ClassVars:
31
+ Enabled: false
32
+
33
+ Style/Documentation:
34
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,53 @@
1
+ ## Changelog
2
+
3
+ ### v1.0.1 (next)
4
+
5
+ * Your contribution here.
6
+
7
+ ### v1.0.0 (November 21, 2020)
8
+
9
+ [#14](https://github.com/EmCousin/grape_fast_jsonapi/pull/14) - [@EmCousin](https://github.com/EmCousin)
10
+
11
+ * renamed gem from `grape_fast_jsonapi` to `grape-jsonapi`
12
+ * Changed dependency from [fast_jsonapi](https://github.com/Netflix/fast_jsonapi) to [jsonapi-serializer](https://github.com/jsonapi-serializer/jsonapi-serializer)
13
+ * Deprecated `Grape::Formatter::FastJsonapi` and `Grape::FastJsonapi::Parser` in favor to `Grape::Formatter::Jsonapi` and `Grape::Jsonapi::Parser`. Will be removed in v1.1
14
+ * Fixed bugs due to breaking changes caused by the switch
15
+ * Added and configured Rubocop
16
+ * Security updates
17
+
18
+ ### v0.2.6 (June 20, 2020)
19
+
20
+ * [#14](https://github.com/EmCousin/grape_fast_jsonapi/pull/14) and [#21](https://github.com/EmCousin/grape_fast_jsonapi/pull/21) - Fixes to swagger parser: Respect `:key` setting, fix column type rendering, allow adding to schema - [@vincentvanbush](https://github.com/vincentvanbush) and [@nathanvda](https://github.com/nathanvda)
21
+
22
+ ### v0.2.5 (January 23, 2020)
23
+
24
+ * [#18](https://github.com/EmCousin/grape_fast_jsonapi/pull/18) - Revert to model_name instead of class-name - [@dblommesteijn](https://github.com/dblommesteijn)
25
+
26
+ Note : This PR fixes a bug when serializing a ActiveRecord::Relation instance, the formatter was looking for a formatter `ActiveRecord::RelationSerializer` serializer that doesn't exist, insteafd of looking for the serializer corresponding to its model name.
27
+
28
+ * Security updates
29
+
30
+ ### v0.2.4 (December 16, 2019)
31
+
32
+ * [#15](https://github.com/EmCousin/grape_fast_jsonapi/pull/15) - Handle serializers which don't have any attributes - [@vesan](https://github.com/vesan)
33
+
34
+ ### v0.2.3 (December 12, 2019)
35
+
36
+ * Reverted v0.2.2 and bumped `loofah` using `dependabot` - [@EmCousin](https://github.com/EmCousin).
37
+
38
+ ### v0.2.2 (December 12, 2019)
39
+
40
+ * Fixed low severity vulnerabiliy issue with `loofah` dependency - [@EmCousin](https://github.com/EmCousin).
41
+
42
+ ### v0.2.1 (September 18, 2019)
43
+
44
+ * [#12](https://github.com/EmCousin/grape_fast_jsonapi/pull/12) - Removed call to `rails` and fixed a potential security issue - [@EmCousin](https://github.com/EmCousin).
45
+
46
+ ### v0.2.0 (February 8, 2019)
47
+
48
+ * [#5](https://github.com/EmCousin/grape_fast_jsonapi/pull/5): Provide custom Grape Swagger parser for fast_jsonapi object serializers, as well as unit test coverage - [@EmCousin](https://github.com/EmCousin)
49
+ * [#6](https://github.com/EmCousin/grape_fast_jsonapi/pull/6) - Fix to make the parser compatible with latest version of fast_jsonapi (1.5 at date) - [@rromanchuk](https://github.com/rromanchuk).
50
+
51
+ ### v0.1.0
52
+
53
+ * Initial public release - [@EmCousin](https://github.com/EmCousin).
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at emmanuel@braidio.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in provet-client.gemspec
6
+ gemspec
7
+
8
+ gem 'brakeman'
9
+ gem 'rake', '~> 13.0'
10
+ gem 'rspec'
11
+ gem 'rubocop'
12
+ gem 'rubocop-performance', require: false
13
+ gem 'rubocop-rake', require: false
14
+ gem 'rubocop-rspec', require: false
15
+ gem 'webmock', group: :test
data/Gemfile.lock ADDED
@@ -0,0 +1,88 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ provet-client (0.1.0)
5
+ httparty
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.2)
13
+ brakeman (5.0.4)
14
+ crack (0.4.5)
15
+ rexml
16
+ diff-lcs (1.4.4)
17
+ hashdiff (1.0.1)
18
+ httparty (0.18.1)
19
+ mime-types (~> 3.0)
20
+ multi_xml (>= 0.5.2)
21
+ mime-types (3.3.1)
22
+ mime-types-data (~> 3.2015)
23
+ mime-types-data (3.2021.0704)
24
+ multi_xml (0.6.0)
25
+ parallel (1.20.1)
26
+ parser (3.0.2.0)
27
+ ast (~> 2.4.1)
28
+ public_suffix (4.0.6)
29
+ rainbow (3.0.0)
30
+ rake (13.0.6)
31
+ regexp_parser (2.1.1)
32
+ rexml (3.2.5)
33
+ rspec (3.10.0)
34
+ rspec-core (~> 3.10.0)
35
+ rspec-expectations (~> 3.10.0)
36
+ rspec-mocks (~> 3.10.0)
37
+ rspec-core (3.10.1)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-expectations (3.10.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-mocks (3.10.2)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-support (3.10.2)
46
+ rubocop (0.93.1)
47
+ parallel (~> 1.10)
48
+ parser (>= 2.7.1.5)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8)
51
+ rexml
52
+ rubocop-ast (>= 0.6.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 2.0)
55
+ rubocop-ast (1.8.0)
56
+ parser (>= 3.0.1.1)
57
+ rubocop-performance (1.10.2)
58
+ rubocop (>= 0.90.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
60
+ rubocop-rake (0.5.1)
61
+ rubocop
62
+ rubocop-rspec (1.44.1)
63
+ rubocop (~> 0.87)
64
+ rubocop-ast (>= 0.7.1)
65
+ ruby-progressbar (1.11.0)
66
+ unicode-display_width (1.7.0)
67
+ webmock (3.13.0)
68
+ addressable (>= 2.3.6)
69
+ crack (>= 0.3.2)
70
+ hashdiff (>= 0.4.0, < 2.0.0)
71
+
72
+ PLATFORMS
73
+ x86_64-darwin-18
74
+ x86_64-linux
75
+
76
+ DEPENDENCIES
77
+ brakeman
78
+ provet-client!
79
+ rake (~> 13.0)
80
+ rspec
81
+ rubocop
82
+ rubocop-performance
83
+ rubocop-rake
84
+ rubocop-rspec
85
+ webmock
86
+
87
+ BUNDLED WITH
88
+ 2.2.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 EmCousin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Provet::Client
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'provet-client', require: false
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install provet-client
18
+
19
+ ## Configuration
20
+
21
+ ```ruby
22
+ require 'provet'
23
+
24
+ Provet.host = "https://us.provetcloud.com" # optional
25
+ Provet.api_version = "0.1" # optional
26
+ Provet.instance = 123 # required
27
+ Provet.token = "your_provet_token" # required
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Every resource available in the ProvetCloud API is mapped with a corresponding class inheriting from `Provet::Base`, which contains the necessary methods to properly consume the API endpoints.
33
+
34
+ The classes are :
35
+ - Provet::Appointment
36
+ - Provet::Availability
37
+ - Provet::Client
38
+ - Provet::ConsultationDischargeInstructions
39
+ - Provet::ConsultationItemTemplate
40
+ - Provet::ConsultationItem
41
+ - Provet::Consultation
42
+ - Provet::Department
43
+ - Provet::InvoiceRow
44
+ - Provet::Invoice
45
+ - Provet::ItemList
46
+ - Provet::ItemTemplateItem
47
+ - Provet::ItemTemplate
48
+ - Provet::Item
49
+ - Provet::LaboratoryAnalysisGroup
50
+ - Provet::Patient
51
+ - Provet::PhoneNumber
52
+ - Provet::ReasonGroup
53
+ - Provet::Reason
54
+ - Provet::ReminderTemplate
55
+ - Provet::Reminder
56
+ - Provet::Shift
57
+ - Provet::ShiftType
58
+ - Provet::UserDetails
59
+ - Provet::UserGroup
60
+ - Provet::User
61
+ - Provet::VatGroup
62
+
63
+ On each of the aforementioned classes you can call the following methods:
64
+
65
+ ### `.base_uri`
66
+
67
+ Returns the base URI of the Provet API. Depends on the Provet instance present in the Rails credentials.
68
+ Example :
69
+
70
+ ```ruby
71
+ Provet::Base.base_uri
72
+ # => "https://us.provetcloud.com/1234/api/0.1" in staging
73
+ ```
74
+
75
+ ### `#list`
76
+
77
+ Returns a list of the designated provet resource. It is paginated by default.
78
+ Example :
79
+
80
+ ```ruby
81
+ res = Provet::Client.new.list
82
+ res.parsed_response
83
+ # => {"count"=>4223, "num_pages"=>85, "next"=>"https://us.provetcloud.com/1234/api/0.1/client/?page=2", "previous"=>nil, "results"=>[{"id"=>1, "url"=>"https://us.provetcloud.com/1234/api/0.1/client/1/", "title"=>nil, "firstname"=>"Helmut", "lastname"=>"Eldridge", "organization_name"=>"", "customer_type"=>0, "vat_number"=>"", "register_number"=>nil, "home_department"=>"https://us.provetcloud.com/1234/api/0.1/department/1/", "due_date_delay"=>nil, "street_address"=>"Job Str.", "street_address_2"=>nil, "street_address_3"=>nil, "zip_code"=>"W11 2BQ", "city"=>"London", "state"=>nil, "email"=>"", "alt_emails"=>nil, "id_number"=>"", "old_client_id"=>nil, "critical_notes"=>nil, "critical_accounting_notes"=>nil, "remarks"=>"", "archived"=>true, "country"=>"", "no_sms"=>false, "no_email"=>false, "external"=>false, "referring_organization"=>false, "parent_referring_organization"=>nil, "referring_vet"=>false, "imported"=>false, "date_imported"=>nil, "patients"=>[], "invoicing_client"=>nil, "tags_rel"=>[], "created"=>"2018-03-26T20:16:25-04:00", "created_user"=>nil, "modified"=>"2021-06-25T14:13:26-04:00", "modified_user"=>"https://us.provetcloud.com/1234/api/0.1/user/8/", "phone_numbers"=>[], "status_type"=>0, "fields_rel"=>[], "farm_code"=>nil, "holdingplacenumbers"=>[], "communication_preferences"=>nil, "production_animal_client"=>false}, # [...]]}
84
+ ```
85
+
86
+ ### `#all`
87
+
88
+ Calls `#list` as many times as there are pages and returns one array with all related resources. Use with caution if many records.
89
+
90
+ Example :
91
+ ```ruby
92
+ all_provet_clients = Provet::Client.new.all
93
+ # => [{"id"=>1, "url"=>"https://us.provetcloud.com/1234/api/0.1/client/1/", "title"=>nil, "firstname"=>"Helmut", "lastname"=>"Eldridge", "organization_name"=>"", "customer_type"=>0, "vat_number"=>"", "register_number"=>nil, "home_department"=>"https://us.provetcloud.com/1234/api/0.1/department/1/", "due_date_delay"=>nil, "street_address"=>"Job Str.", "street_address_2"=>nil, "street_address_3"=>nil, "zip_code"=>"W11 2BQ", "city"=>"London", "state"=>nil, "email"=>"", "alt_emails"=>nil, "id_number"=>"", "old_client_id"=>nil, "critical_notes"=>nil, "critical_accounting_notes"=>nil, "remarks"=>"", "archived"=>true, "country"=>"", "no_sms"=>false, "no_email"=>false, "external"=>false, "referring_organization"=>false, "parent_referring_organization"=>nil, "referring_vet"=>false, "imported"=>false, "date_imported"=>nil, "patients"=>[], "invoicing_client"=>nil, "tags_rel"=>[], "created"=>"2018-03-26T20:16:25-04:00", "created_user"=>nil, "modified"=>"2021-06-25T14:13:26-04:00", "modified_user"=>"https://us.provetcloud.com/1234/api/0.1/user/8/", "phone_numbers"=>[], "status_type"=>0, "fields_rel"=>[], "farm_code"=>nil, "holdingplacenumbers"=>[], "communication_preferences"=>nil, "production_animal_client"=>false}, {[...]}]
94
+ ```
95
+
96
+
97
+ ### `#find(id: String)`
98
+
99
+ Returns the corresponding provet resource.
100
+
101
+ ```ruby
102
+ res = Provet::Client.new.find(1)
103
+ res.parsed_response
104
+ # => {"id"=>1, "url"=>"https://us.provetcloud.com/1234/api/0.1/client/1/", "title"=>nil, "firstname"=>"Helmut", "lastname"=>"Eldridge", "organization_name"=>"", "customer_type"=>0, "vat_number"=>"", "register_number"=>nil, "home_department"=>"https://us.provetcloud.com/1234/api/0.1/department/1/", "due_date_delay"=>nil, "street_address"=>"Job Str.", "street_address_2"=>nil, "street_address_3"=>nil, "zip_code"=>"W11 2BQ", "city"=>"London", "state"=>nil, "email"=>"", "alt_emails"=>nil, "id_number"=>"", "old_client_id"=>nil, "critical_notes"=>nil, "critical_accounting_notes"=>nil, "remarks"=>"", "archived"=>true, "country"=>"", "no_sms"=>false, "no_email"=>false, "external"=>false, "referring_organization"=>false, "parent_referring_organization"=>nil, "referring_vet"=>false, "imported"=>false, "date_imported"=>nil, "patients"=>[], "invoicing_client"=>nil, "tags_rel"=>[], "created"=>"2018-03-26T20:16:25-04:00", "created_user"=>nil, "modified"=>"2021-06-25T14:13:26-04:00", "modified_user"=>"https://us.provetcloud.com/1234/api/0.1/user/8/", "phone_numbers"=>[], "status_type"=>0, "fields_rel"=>[], "farm_code"=>nil, "holdingplacenumbers"=>[], "communication_preferences"=>nil, "production_animal_client"=>false}
105
+ ```
106
+
107
+ ### `#create(payload: JSON)`
108
+
109
+ Creates a Provet resource and returns that resource.
110
+ Example :
111
+
112
+ ```ruby
113
+ payload = {
114
+ firstname: "Luke",
115
+ lastname: "Skywalker",
116
+ email: "luke@example.com",
117
+ patients: [],
118
+ }
119
+
120
+ res = Provet::Client.new.create(payload.to_json)
121
+ res.parsed_response
122
+ # => {"id"=>42, "url"=>"https://us.provetcloud.com/1234/api/0.1/client/42/", "title"=>nil, "firstname"=>"Luke", "lastname"=>"Skywalker", "organization_name"=>"", "customer_type"=>0, "vat_number"=>"", "register_number"=>nil, "home_department"=>"https://us.provetcloud.com/1234/api/0.1/department/1/", "due_date_delay"=>nil, "street_address"=>"Job Str.", "street_address_2"=>nil, "street_address_3"=>nil, "zip_code"=>"nil", "city"=>"nil", "state"=>nil, "email"=>"", "alt_emails"=>nil, "id_number"=>"", "old_client_id"=>nil, "critical_notes"=>nil, "critical_accounting_notes"=>nil, "remarks"=>"", "archived"=>true, "country"=>"", "no_sms"=>false, "no_email"=>false, "external"=>false, "referring_organization"=>false, "parent_referring_organization"=>nil, "referring_vet"=>false, "imported"=>false, "date_imported"=>nil, "patients"=>[], "invoicing_client"=>nil, "tags_rel"=>[], "created"=>"2021-03-26T20:16:25-04:00", "created_user"=>nil, "modified"=>"2021-06-25T14:13:26-04:00", "modified_user"=>nil, "phone_numbers"=>[], "status_type"=>0, "fields_rel"=>[], "farm_code"=>nil, "holdingplacenumbers"=>[], "communication_preferences"=>nil, "production_animal_client"=>false}
123
+ ```
124
+
125
+ ### `#update(id: String, payload: JSON)`
126
+ Updates a Provet resource and returns that resource.
127
+
128
+ ```ruby
129
+ payload = {
130
+ firstname: "Luke",
131
+ lastname: "Skywalker",
132
+ email: "luke@example.com",
133
+ patients: [],
134
+ }
135
+
136
+ res = Provet::Client.new.update(1, payload.to_json)
137
+ res.parsed_response
138
+ # => {"id"=>1, "url"=>"https://us.provetcloud.com/1234/api/0.1/client/1/", "title"=>nil, "firstname"=>"Luke", "lastname"=>"Skywalker", "organization_name"=>"", "customer_type"=>0, "vat_number"=>"", "register_number"=>nil, "home_department"=>"https://us.provetcloud.com/1234/api/0.1/department/1/", "due_date_delay"=>nil, "street_address"=>"Job Str.", "street_address_2"=>nil, "street_address_3"=>nil, "zip_code"=>"nil", "city"=>"nil", "state"=>nil, "email"=>"", "alt_emails"=>nil, "id_number"=>"", "old_client_id"=>nil, "critical_notes"=>nil, "critical_accounting_notes"=>nil, "remarks"=>"", "archived"=>true, "country"=>"", "no_sms"=>false, "no_email"=>false, "external"=>false, "referring_organization"=>false, "parent_referring_organization"=>nil, "referring_vet"=>false, "imported"=>false, "date_imported"=>nil, "patients"=>[], "invoicing_client"=>nil, "tags_rel"=>[], "created"=>"2021-03-26T20:16:25-04:00", "created_user"=>nil, "modified"=>"2021-06-25T14:13:26-04:00", "modified_user"=>nil, "phone_numbers"=>[], "status_type"=>0, "fields_rel"=>[], "farm_code"=>nil, "holdingplacenumbers"=>[], "communication_preferences"=>nil, "production_animal_client"=>false}
139
+ ```
140
+
141
+ ### `#destroy(id: String)`
142
+
143
+ Destroys a Provet resource.
144
+ Example:
145
+
146
+ ```ruby
147
+ res = Provet::Client.new.destroy(1)
148
+ ```
149
+
150
+ ## Additional notes
151
+
152
+ ### Non allowed methods
153
+
154
+ Some endpoints do not allow certain requests to be made. For example, you can read user groups, but you can't write (create, update or destroy). When an attempt at calling a method that is not allowed, a `Provet::MethodNotAllowedError` error will be thrown.
155
+
156
+ ### Soft deletion
157
+
158
+ Some Provet resources are configured to be soft-deletable with this gem:
159
+ - Provet::Appointment
160
+ - Provet::Client
161
+ - Provet::Patient
162
+ - Provet::User
163
+
164
+ For these classes, calling `#destroy` will perform a `PATCH` http request to archive the resource in Provet, instead of actually erasing it.
165
+
166
+ Some of those soft-deletable resources can be hard-destroy by calling `#really_destroy!` on them.
167
+
168
+ ## Development
169
+
170
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
171
+
172
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
173
+
174
+ ## Contributing
175
+
176
+ Bug reports and pull requests are welcome on GitHub at https://github.com/EmCousin/provet-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/EmCousin/provet-client/blob/master/CODE_OF_CONDUCT.md).
177
+
178
+ ## License
179
+
180
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
181
+
182
+ ## Code of Conduct
183
+
184
+ Everyone interacting in the Provet::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/provet-client/blob/master/CODE_OF_CONDUCT.md).