noyo 0.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.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +57 -0
  3. data/.codecov.yml +13 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +73 -0
  7. data/.ruby-version +1 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +4 -0
  10. data/Gemfile.lock +89 -0
  11. data/README.md +176 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +7 -0
  14. data/bin/setup +8 -0
  15. data/lib/noyo.rb +3 -0
  16. data/lib/noyo_accounts.rb +4 -0
  17. data/lib/noyo_accounts/client.rb +6 -0
  18. data/lib/noyo_accounts/client/services.rb +8 -0
  19. data/lib/noyo_accounts/client/services/auth_service.rb +45 -0
  20. data/lib/noyo_api.rb +6 -0
  21. data/lib/noyo_api/api.rb +13 -0
  22. data/lib/noyo_api/client.rb +9 -0
  23. data/lib/noyo_api/client/services.rb +8 -0
  24. data/lib/noyo_api/client/services/base_service.rb +37 -0
  25. data/lib/noyo_api/client/user_agent.rb +15 -0
  26. data/lib/noyo_api/client/version.rb +5 -0
  27. data/lib/noyo_api/configuration.rb +28 -0
  28. data/lib/noyo_fulfillment.rb +5 -0
  29. data/lib/noyo_fulfillment/api_response.rb +32 -0
  30. data/lib/noyo_fulfillment/models.rb +25 -0
  31. data/lib/noyo_fulfillment/models/api_resource.rb +191 -0
  32. data/lib/noyo_fulfillment/models/api_resource_collection.rb +41 -0
  33. data/lib/noyo_fulfillment/models/base_model.rb +115 -0
  34. data/lib/noyo_fulfillment/models/contact.rb +19 -0
  35. data/lib/noyo_fulfillment/models/demographic_change.rb +8 -0
  36. data/lib/noyo_fulfillment/models/dependent.rb +15 -0
  37. data/lib/noyo_fulfillment/models/employee.rb +108 -0
  38. data/lib/noyo_fulfillment/models/group.rb +25 -0
  39. data/lib/noyo_fulfillment/models/group_enrollment.rb +20 -0
  40. data/lib/noyo_fulfillment/models/group_plans.rb +15 -0
  41. data/lib/noyo_fulfillment/models/group_plans/add.rb +11 -0
  42. data/lib/noyo_fulfillment/models/group_plans/base.rb +22 -0
  43. data/lib/noyo_fulfillment/models/group_plans/dental.rb +13 -0
  44. data/lib/noyo_fulfillment/models/group_plans/life.rb +11 -0
  45. data/lib/noyo_fulfillment/models/group_plans/long_term_disability.rb +11 -0
  46. data/lib/noyo_fulfillment/models/group_plans/medical.rb +12 -0
  47. data/lib/noyo_fulfillment/models/group_plans/short_term_disability.rb +11 -0
  48. data/lib/noyo_fulfillment/models/group_plans/vision.rb +11 -0
  49. data/lib/noyo_fulfillment/models/individual_enrollment.rb +32 -0
  50. data/lib/noyo_fulfillment/models/location.rb +16 -0
  51. data/lib/noyo_fulfillment/models/member_request.rb +40 -0
  52. data/lib/noyo_fulfillment/models/member_transaction.rb +27 -0
  53. data/lib/noyo_fulfillment/models/mixins.rb +9 -0
  54. data/lib/noyo_fulfillment/models/mixins/has_person.rb +29 -0
  55. data/lib/noyo_fulfillment/models/mixins/nested_under.rb +64 -0
  56. data/lib/noyo_fulfillment/models/new_hire.rb +7 -0
  57. data/lib/noyo_fulfillment/models/open_enrollment.rb +7 -0
  58. data/lib/noyo_fulfillment/models/person.rb +18 -0
  59. data/lib/noyo_fulfillment/models/qualifying_life_event.rb +8 -0
  60. data/lib/noyo_fulfillment/models/termination.rb +9 -0
  61. data/noyo.gemspec +47 -0
  62. metadata +232 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8c5e14f7a5c861abe208d64f6809ae2f13c6b09305183729916fe6460891371a
4
+ data.tar.gz: 6e29ece08bd7d66756b75372ac490dd61469b4feb151e0e430ad441e66913320
5
+ SHA512:
6
+ metadata.gz: 90cf7274e4020311659116d82d1d2df4fca1a25fa325a9b8dccbbb650c6d8aa2cbd98c96a74a3876524ff4b5eb62c1a5997c1210f41f60172e7ff1e2444e2365
7
+ data.tar.gz: e85c579d6b38e6bbe8b4b426e023bdda0293f69ff22673488f3e34ac4d31536efff84cffb007fcbdeff20eb46981a4d8384b4700e3314cc594648499e31bf1dc
@@ -0,0 +1,57 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.6.3
11
+
12
+ # Specify service dependencies here if necessary
13
+ # CircleCI maintains a library of pre-built images
14
+ # documented at https://circleci.com/docs/2.0/circleci-images/
15
+ # - image: circleci/postgres:9.4
16
+
17
+ working_directory: ~/repo
18
+
19
+ steps:
20
+ - checkout
21
+
22
+ # Download and cache dependencies
23
+ - restore_cache:
24
+ keys:
25
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+ # fallback to using the latest cache if no exact match is found
27
+ - v1-dependencies-
28
+
29
+ - run:
30
+ name: install dependencies
31
+ command: |
32
+ gem install bundler
33
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
34
+
35
+ - save_cache:
36
+ paths:
37
+ - ./vendor/bundle
38
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
39
+
40
+ # run tests!
41
+ - run:
42
+ name: run tests
43
+ command: |
44
+ CI=TRUE bundle exec rspec
45
+
46
+ # collect reports
47
+ - store_test_results:
48
+ path: /tmp/test-results
49
+ - store_artifacts:
50
+ path: /tmp/test-results
51
+ destination: test-results
52
+
53
+ - run:
54
+ name: Upload Coverage
55
+ command: |
56
+ bash <(curl -s https://codecov.io/bash) \
57
+ -f ./coverage/.resultset.json
@@ -0,0 +1,13 @@
1
+ codecov:
2
+ token: 0cb82650-767d-4502-90fa-ed6f4b932ffc
3
+
4
+ coverage:
5
+ status:
6
+ project:
7
+ default:
8
+ enabled: yes
9
+ target: 80%
10
+ patch:
11
+ default:
12
+ enabled: yes
13
+ target: 65%
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,73 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3.8
3
+ TargetRailsVersion: 5.0.7
4
+
5
+ Style/BlockDelimiters:
6
+ Enabled: false
7
+
8
+ Style/ConditionalAssignment:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/FrozenStringLiteralComment:
15
+ Enabled: false
16
+
17
+ Style/HashSyntax:
18
+ EnforcedStyle: ruby19
19
+
20
+ Style/PercentLiteralDelimiters:
21
+ PreferredDelimiters:
22
+ "%w": '[]'
23
+
24
+ Style/RescueModifier:
25
+ Enabled: false
26
+
27
+ Style/SymbolArray:
28
+ Enabled: false
29
+
30
+ Style/TrailingCommaInArguments:
31
+ EnforcedStyleForMultiline: consistent_comma
32
+
33
+ Style/TrailingCommaInArrayLiteral:
34
+ EnforcedStyleForMultiline: consistent_comma
35
+
36
+ Style/TrailingCommaInHashLiteral:
37
+ EnforcedStyleForMultiline: consistent_comma
38
+
39
+ Style/NegatedIf:
40
+ Enabled: false
41
+
42
+ Layout/AlignParameters:
43
+ EnforcedStyle: with_fixed_indentation
44
+
45
+ Layout/DotPosition:
46
+ EnforcedStyle: leading
47
+
48
+ Layout/FirstArrayElementLineBreak:
49
+ Enabled: true
50
+
51
+ Layout/IndentFirstArrayElement:
52
+ EnforcedStyle: consistent
53
+
54
+ Layout/IndentFirstHashElement:
55
+ EnforcedStyle: consistent
56
+
57
+ Layout/MultilineMethodCallIndentation:
58
+ EnforcedStyle: indented
59
+
60
+ Layout/MultilineOperationIndentation:
61
+ EnforcedStyle: indented
62
+
63
+ Layout/SpaceBeforeBlockBraces:
64
+ EnforcedStyle: no_space
65
+
66
+ Layout/SpaceInsideArrayLiteralBrackets:
67
+ EnforcedStyle: space
68
+
69
+ Metrics/LineLength:
70
+ Max: 100
71
+
72
+ Metrics/MethodLength:
73
+ Max: 20
@@ -0,0 +1 @@
1
+ 2.6.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at eng-admin@gonoyo.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in noyo.gemspec
4
+ gemspec
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ noyo (0.1.0)
5
+ factory_bot (~> 5.0.2)
6
+ faker (~> 1.9.3)
7
+ httparty (~> 0.17.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.0.0)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.1, >= 2.1.8)
18
+ addressable (2.6.0)
19
+ public_suffix (>= 2.0.2, < 4.0)
20
+ codecov (0.1.14)
21
+ json
22
+ simplecov
23
+ url
24
+ concurrent-ruby (1.1.5)
25
+ crack (0.4.3)
26
+ safe_yaml (~> 1.0.0)
27
+ diff-lcs (1.3)
28
+ docile (1.3.1)
29
+ factory_bot (5.0.2)
30
+ activesupport (>= 4.2.0)
31
+ faker (1.9.6)
32
+ i18n (>= 0.7)
33
+ hashdiff (0.3.9)
34
+ httparty (0.17.0)
35
+ mime-types (~> 3.0)
36
+ multi_xml (>= 0.5.2)
37
+ i18n (1.6.0)
38
+ concurrent-ruby (~> 1.0)
39
+ json (2.2.0)
40
+ mime-types (3.2.2)
41
+ mime-types-data (~> 3.2015)
42
+ mime-types-data (3.2019.0331)
43
+ minitest (5.11.3)
44
+ multi_xml (0.6.0)
45
+ public_suffix (3.0.3)
46
+ rake (10.5.0)
47
+ rspec (3.8.0)
48
+ rspec-core (~> 3.8.0)
49
+ rspec-expectations (~> 3.8.0)
50
+ rspec-mocks (~> 3.8.0)
51
+ rspec-core (3.8.0)
52
+ rspec-support (~> 3.8.0)
53
+ rspec-expectations (3.8.3)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-mocks (3.8.0)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-support (3.8.0)
60
+ safe_yaml (1.0.5)
61
+ simplecov (0.16.1)
62
+ docile (~> 1.1)
63
+ json (>= 1.8, < 3)
64
+ simplecov-html (~> 0.10.0)
65
+ simplecov-html (0.10.2)
66
+ thread_safe (0.3.6)
67
+ tzinfo (1.2.5)
68
+ thread_safe (~> 0.1)
69
+ url (0.3.2)
70
+ webmock (3.5.1)
71
+ addressable (>= 2.3.6)
72
+ crack (>= 0.3.2)
73
+ hashdiff
74
+ zeitwerk (2.1.9)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ bundler (~> 1.17.3)
81
+ codecov (~> 0.1.14)
82
+ noyo!
83
+ rake (~> 10.0)
84
+ rspec (~> 3.0)
85
+ simplecov (~> 0.16.1)
86
+ webmock (~> 3.5.1)
87
+
88
+ BUNDLED WITH
89
+ 1.17.3
@@ -0,0 +1,176 @@
1
+ # Noyo Fulfillment Ruby Library
2
+
3
+ A Ruby client for Noyo's Fulfillment Service API
4
+
5
+ [![CircleCI](https://circleci.com/gh/noyo-technologies/noyo-ruby.svg?style=svg&circle-token=4841c7717865a43b4417109b30d016452dc08951)](https://circleci.com/gh/noyo-technologies/noyo-ruby)
6
+
7
+ [![codecov](https://codecov.io/gh/noyo-technologies/noyo-ruby/branch/master/graph/badge.svg?token=QRT59Dq2kq)](https://codecov.io/gh/noyo-technologies/noyo-ruby)
8
+
9
+ ## Ruby Version
10
+
11
+ This client was written to target Ruby 2.6.3. Other version support not yet guaranteed.
12
+
13
+ ## Noyo API Docs
14
+
15
+ While using this client library, [the Noyo API docs](https://docs.noyoconnect.com) should be referenced for wider context. This
16
+ will also give you a reference for things like validation and schemas, which this client library
17
+ typically does not provide.
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'noyo'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install noyo
34
+
35
+ ## REPL
36
+
37
+ During development of this library, run `./bin/console` for an irb REPL with this module included.
38
+
39
+ ## Usage
40
+
41
+ ### Configuration
42
+
43
+ Once you have a client ID and secret for your organization from Noyo, you can use it to configure
44
+ your Noyo connection similar to the sample below. A sample tweak assuming you're running Rails is
45
+ used below to give you an idea of a common usage.
46
+
47
+ ```
48
+ NoyoApi::Api.configure do |config|
49
+ config.client_id = "" # your Noyo client ID
50
+ config.client_secret = "" # your Noyo client secret
51
+
52
+ if not Rails.env.production?
53
+ # For experimental development
54
+ config.fulfillment_base_uri = 'https://fulfillment-sandbox.noyoconnect.com'
55
+ end
56
+ end
57
+ ```
58
+
59
+ If you'd like to debug the API calls being made, add a `config.verbose = true` to the
60
+ configuration block. This will give you information on the underlying HTTPS calls being made.
61
+
62
+ ### Querying
63
+
64
+ #### #all
65
+
66
+ You can find all resources for a given model using the `all` class method:
67
+
68
+ ```
69
+ groups = NoyoFulfillment::Group.all
70
+ ```
71
+
72
+ This will return a `ApiResourceCollection`. This is a paginated collection. You can get the next
73
+ page of data easily:
74
+
75
+ ```
76
+ more_groups = groups.next_page
77
+ ```
78
+
79
+ #### #find
80
+
81
+ You can also just find one record for a model by ID:
82
+
83
+ ```
84
+ group = NoyoFulfillment::Group.find('065f876d-d557-4019-8607-439b19235fa0')
85
+ ```
86
+
87
+ #### Nested Resources
88
+
89
+ You can find nested resources using model helpers:
90
+
91
+ ```
92
+ locations = group.locations # returns an ApiResourceCollection of locations
93
+ ```
94
+
95
+ This is just syntactical sugar for:
96
+
97
+ ```
98
+ locations = NoyoFulfillment::Location.all(group_id: group.id)
99
+ ```
100
+
101
+ ### Creating data during development
102
+
103
+ You can take advantage of the [FactoryBot](https://github.com/thoughtbot/factory_bot) factories built into this library, in order to speed up development time.
104
+
105
+ #### Create an employee
106
+
107
+ ```
108
+ # Boilerplate to bring in factories. Could be used in a spec_helper,
109
+ # or other initialization code during the development phase.
110
+ require 'factory_bot'
111
+ FactoryBot.find_definitions
112
+ require 'faker'
113
+
114
+ groups = NoyoFulfillment::Group.all
115
+ group = groups.records.first # Find an appropriate group using this collection
116
+ locations = group.locations
117
+ location = locations.records.first
118
+ employee = FactoryBot.build(:employee, group_id: group.id, location_id: location.id)
119
+ employee = employee.create
120
+ ```
121
+
122
+ All employee values not specified will be faked using the [faker gem](https://github.com/stympy/faker).
123
+
124
+ #### Create a dependent
125
+
126
+ Given an employee object returned from the API:
127
+
128
+ ```
129
+ dependent = FactoryBot.build(:dependent, employee_id: employee.id)
130
+ dependent = dependent.create
131
+ ```
132
+
133
+ #### Create a new hire request
134
+
135
+ Once an employee is created, you can use the model to enroll that employee into coverages:
136
+
137
+ ```
138
+ new_hire = FactoryBot.build(:new_hire, employee_id: employee.id, carrier_id: '5d9cf3ac-ea6d-4035-a478-3b9839866a7b', dental_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b', vision_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b')
139
+ new_hire_request = employee.create_new_hire_request(new_hire.attributes)
140
+ ```
141
+
142
+ #### Create a termination request
143
+
144
+ Given an employee object returned from the API:
145
+
146
+ ```
147
+ termination = FactoryBot.build(:termination, employee_id: employee.id)
148
+ termination_request = employee.create_termination_request(termination.attributes)
149
+ ```
150
+
151
+ #### Create a demographic change request
152
+
153
+ Given an employee object returned from the API:
154
+
155
+ ```
156
+ demographic_change = FactoryBot.build(:demographic_change, member_type: 'employee', employee_id: employee.id)
157
+ demographic_change_request = employee.create_demographic_change_request(demographic_change.attributes)
158
+ ```
159
+
160
+ #### Create an open enrollment request
161
+
162
+ Given an employee object returned from the API:
163
+
164
+ ```
165
+ open_enrollment = FactoryBot.build(:open_enrollment, member_type: 'employee', employee_id: employee.id, carrier_id: '5d9cf3ac-ea6d-4035-a478-3b9839866a7b', dental_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b', vision_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b')
166
+ open_enrollment_request = employee.create_open_enrollment_request(open_enrollment.attributes)
167
+ ```
168
+
169
+ #### Create a qualifying life event request
170
+
171
+ Given an employee object returned from the API:
172
+
173
+ ```
174
+ qualifying_life_event = FactoryBot.build(:qualifying_life_event, member_type: 'employee', employee_id: employee.id, carrier_id: '5d9cf3ac-ea6d-4035-a478-3b9839866a7b', dental_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b', vision_plan_id: 'bd90742f-f019-4a4b-b1d6-3038921e936b')
175
+ qualifying_life_event_request = employee.create_qualifying_life_event_request(qualifying_life_event.attributes)
176
+ ```