fountain-papi 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2bbdbeb5c23aba4ccce04ea6388164db25f1605791c71f418a93614207a34f76
4
+ data.tar.gz: 64a18f729b985d07af85d1a5119a936634b8d8c83c48ad06d7306e4c43c7030a
5
+ SHA512:
6
+ metadata.gz: 943343fa0f4af9bd5b6c6e47acaf6db42da74ebf2effe2af1de0b456bca7248a549f974d0f21cfb3a68c04499759bdc633ec25c7c3abd7a49e66a38679441af5
7
+ data.tar.gz: eb7d9959c8b1aa616aaccd6c9aff8d4ae0923bffafa470c1d109b1f142457d8bae1aabbb7113b08709adbcc6fc89dddfcfc168477272232e3e92673b5a7b69d3
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-06-01
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in fountain-papi.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,105 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fountain-papi (0.1.0)
5
+ dry-struct (~> 1.4)
6
+ httparty (~> 0.20.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.2)
14
+ coderay (1.1.3)
15
+ concurrent-ruby (1.1.10)
16
+ crack (0.4.5)
17
+ rexml
18
+ diff-lcs (1.5.0)
19
+ dry-configurable (0.15.0)
20
+ concurrent-ruby (~> 1.0)
21
+ dry-core (~> 0.6)
22
+ dry-container (0.9.0)
23
+ concurrent-ruby (~> 1.0)
24
+ dry-configurable (~> 0.13, >= 0.13.0)
25
+ dry-core (0.7.1)
26
+ concurrent-ruby (~> 1.0)
27
+ dry-inflector (0.2.1)
28
+ dry-logic (1.2.0)
29
+ concurrent-ruby (~> 1.0)
30
+ dry-core (~> 0.5, >= 0.5)
31
+ dry-struct (1.4.0)
32
+ dry-core (~> 0.5, >= 0.5)
33
+ dry-types (~> 1.5)
34
+ ice_nine (~> 0.11)
35
+ dry-types (1.5.1)
36
+ concurrent-ruby (~> 1.0)
37
+ dry-container (~> 0.3)
38
+ dry-core (~> 0.5, >= 0.5)
39
+ dry-inflector (~> 0.1, >= 0.1.2)
40
+ dry-logic (~> 1.0, >= 1.0.2)
41
+ hashdiff (1.0.1)
42
+ httparty (0.20.0)
43
+ mime-types (~> 3.0)
44
+ multi_xml (>= 0.5.2)
45
+ ice_nine (0.11.2)
46
+ method_source (1.0.0)
47
+ mime-types (3.4.1)
48
+ mime-types-data (~> 3.2015)
49
+ mime-types-data (3.2022.0105)
50
+ multi_xml (0.6.0)
51
+ parallel (1.22.1)
52
+ parser (3.1.2.0)
53
+ ast (~> 2.4.1)
54
+ pry (0.14.1)
55
+ coderay (~> 1.1)
56
+ method_source (~> 1.0)
57
+ public_suffix (4.0.7)
58
+ rainbow (3.1.1)
59
+ rake (13.0.6)
60
+ regexp_parser (2.5.0)
61
+ rexml (3.2.5)
62
+ rspec (3.11.0)
63
+ rspec-core (~> 3.11.0)
64
+ rspec-expectations (~> 3.11.0)
65
+ rspec-mocks (~> 3.11.0)
66
+ rspec-core (3.11.0)
67
+ rspec-support (~> 3.11.0)
68
+ rspec-expectations (3.11.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.11.0)
71
+ rspec-mocks (3.11.1)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.11.0)
74
+ rspec-support (3.11.0)
75
+ rubocop (1.30.0)
76
+ parallel (~> 1.10)
77
+ parser (>= 3.1.0.0)
78
+ rainbow (>= 2.2.2, < 4.0)
79
+ regexp_parser (>= 1.8, < 3.0)
80
+ rexml (>= 3.2.5, < 4.0)
81
+ rubocop-ast (>= 1.18.0, < 2.0)
82
+ ruby-progressbar (~> 1.7)
83
+ unicode-display_width (>= 1.4.0, < 3.0)
84
+ rubocop-ast (1.18.0)
85
+ parser (>= 3.1.1.0)
86
+ ruby-progressbar (1.11.0)
87
+ unicode-display_width (2.1.0)
88
+ webmock (3.14.0)
89
+ addressable (>= 2.8.0)
90
+ crack (>= 0.3.2)
91
+ hashdiff (>= 0.4.0, < 2.0.0)
92
+
93
+ PLATFORMS
94
+ x86_64-darwin-20
95
+
96
+ DEPENDENCIES
97
+ fountain-papi!
98
+ pry
99
+ rake (~> 13.0)
100
+ rspec (~> 3.0)
101
+ rubocop (~> 1.21)
102
+ webmock
103
+
104
+ BUNDLED WITH
105
+ 2.3.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Joey Cody
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,120 @@
1
+ # Fountain PAPI Ruby Client
2
+
3
+ [Fountain Partners API (PAPI)](https://partners.fountain.com/) ruby client. Helps get started quickly interfacing with PAPI. Today, the library allows for creating partner statuses for an applicant.
4
+
5
+ In the future, this library is intended be at feature-parity with PAPI operations.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fountain-papi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fountain-papi
22
+
23
+ ## Configuration
24
+
25
+ Create an initializer in `config/initializers/fountain_papi.rb` with your Partner ID and API Key:
26
+
27
+ ```ruby
28
+ Fountain::Papi.configure do |config|
29
+ config.api_key = "db516773-4615-4bfa-bce8-94fe9bb951b2" # YOUR API KEY HERE
30
+ config.partner_id = "3870fc40-d0f7-449e-8152-2a741ef3b301" # YOUR PARTNER ID HERE
31
+
32
+ # Additional options:
33
+ # config.sandbox = true
34
+ # config.version = 1
35
+ end
36
+ ```
37
+
38
+ If you do not have either of those keys, please reach out to your Fountain partner representative.
39
+
40
+ When you're ready to update your partner to production, set `config.sandbox = false` in the above configuration.
41
+
42
+ ## Usage
43
+
44
+ Today the Ruby client supports [creating Applicant statuses](https://partners.fountain.com/reference/post_v1-partners-id-applicants-applicant-id-status).
45
+
46
+ ```ruby
47
+ result = Fountain::Papi.create_status(
48
+ applicant_id: "231ea206-4d6e-4d7c-80d0-81dff956a197",
49
+ status: "in_progress",
50
+ )
51
+
52
+ # => #<Fountain::Papi::Applicant::Status status="in_progress" applicant_id="231ea206-4d6e-4d7c-80d0-81dff956a197" account_option=nil link_title=nil title=nil url=nil category=nil color="green" display_status="[Partner Name] In Progress" display_title="[Partner Name] In Progress" external_id="b87ab326-ee84-40aa-a28e-9d520cfeaca8" show_redo=false status_type=nil>
53
+
54
+ result.status
55
+ # => "in_progress"
56
+
57
+ result.applicant_id
58
+ # => "231ea206-4d6e-4d7c-80d0-81dff956a197"
59
+
60
+ result.display_status
61
+ # => "[Partner Name] In Progress"
62
+
63
+ result.url
64
+ # => nil
65
+ ```
66
+
67
+ options for `status` param are:
68
+ - `incomplete`
69
+ - `in_progress`
70
+ - `pending_action`
71
+ - `completed`
72
+ - `error`
73
+
74
+ ### Additional options when creating an applicant status:
75
+
76
+ ```ruby
77
+ Fountain::Papi.create_status(
78
+ applicant_id: "231ea206-4d6e-4d7c-80d0-81dff956a197",
79
+ status: "completed",
80
+ account_option: "report_type_1",
81
+ category: "string",
82
+ link_title: "Our report results",
83
+ status_type: "foobar",
84
+ title: "Great Title",
85
+ url: "http://fountain.com/our_link",
86
+ )
87
+
88
+ # => #<Fountain::Papi::Applicant::Status status="completed" applicant_id="231ea206-4d6e-4d7c-80d0-81dff956a197" account_option=nil link_title="Fountain.com" title="Our new title" url="https://www.fountain.com/our_link" category=nil color="green" display_status="[Partner Name] Completed" display_title="[Partner Name] Great Title" external_id="b87ab326-ee84-40aa-a28e-9d520cfeaca8" show_redo=false status_type=nil>
89
+ ```
90
+
91
+ ##### `title`
92
+
93
+ Title that will show on the applicant's profile on Fountain. Useful for labeling the applicant with quick details (i.e. "Score: 85%") that are viewed on the Applicant Table.
94
+
95
+ ##### `category`
96
+
97
+ TODO:
98
+
99
+ ##### `link_title`
100
+
101
+ (presumably) The title that is shown for the URL link.
102
+
103
+ ##### `url`
104
+
105
+ URL that can be clicked on from the applicant's status label. Useful for viewing additional details -- i.e. a report, partner website, etc -- that might be useful to the recruiter using Fountain.
106
+
107
+
108
+ ## Development
109
+
110
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
111
+
112
+ 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).
113
+
114
+ ## Contributing
115
+
116
+ Bug reports and pull requests are welcome on GitHub at [onboardiq/fountain-papi](https://github.com/onboardiq/fountain-papi).
117
+
118
+ ## License
119
+
120
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,36 @@
1
+ module Fountain
2
+ module Papi
3
+ def self.create_status(params)
4
+ Applicant::CreateStatus.new(params).call
5
+ end
6
+
7
+ module Applicant
8
+ class CreateStatus
9
+ attr_reader :status
10
+
11
+ def initialize(params)
12
+ @status = Fountain::Papi::Applicant::Status.new(params)
13
+ end
14
+
15
+ def call
16
+ response = Client.post(
17
+ "#{Fountain::Papi.config.base_uri}/applicants/#{status.applicant_id}/status",
18
+ body: { applicant: { partner_status: status } }.to_json,
19
+ headers: Fountain::Papi.config.headers
20
+ )
21
+
22
+ raise Fountain::Papi::Error.new(response) unless response.success?
23
+
24
+ created_status(response)
25
+ end
26
+
27
+ def created_status(response)
28
+ result_status = response["partner_status"].
29
+ merge(applicant_id: status.applicant_id)
30
+
31
+ Fountain::Papi::Applicant::Status.new(result_status)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,29 @@
1
+ module Fountain
2
+ module Papi
3
+ module Applicant
4
+ class Status < Dry::Struct
5
+ transform_keys(&:to_sym)
6
+
7
+ Statuses = Types::String.enum("incomplete", "in_progress", "pending_action", "completed", "error")
8
+
9
+ attribute :status, Statuses
10
+ attribute :applicant_id, Types::UUID
11
+
12
+ # optional request attributes:
13
+ attribute? :account_option, Types::Coercible::String.optional
14
+ attribute? :link_title, Types::Strict::String.optional
15
+ attribute? :title, Types::Strict::String
16
+ attribute? :url, Types::Strict::String.optional
17
+
18
+ # response attributes:
19
+ attribute? :category, Types::Strict::String.optional
20
+ attribute? :color, Types::Strict::String
21
+ attribute? :display_status, Types::Strict::String
22
+ attribute? :display_title, Types::Strict::String
23
+ attribute? :external_id, Types::UUID
24
+ attribute? :show_redo, Types::Params::Bool.optional
25
+ attribute? :status_type, Types::Strict::String.optional
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module Fountain
2
+ module Papi
3
+ class Client
4
+ include HTTParty
5
+
6
+ format :json
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ module Fountain
2
+ module Papi
3
+ class Config
4
+ attr_accessor :api_key
5
+ attr_accessor :partner_id
6
+ attr_accessor :sandbox
7
+ attr_accessor :version
8
+ attr_accessor :base_domain
9
+
10
+ def initialize
11
+ @api_key = nil # Partner API Key
12
+ @partner_id = nil # Parter Identifier
13
+ @sandbox = true # Default to sandbox
14
+ @version = 1 # API version
15
+ @base_domain = "https://partners-sandbox.fountain.com" # Default to sandbox base domain
16
+ end
17
+
18
+ def base_uri
19
+ "#{base_domain}/v#{version}/partners/#{partner_id}"
20
+ end
21
+
22
+ def headers
23
+ {
24
+ "Content-Type" => "application/json",
25
+ "X-ACCESS-TOKEN" => api_key
26
+ }
27
+ end
28
+ end
29
+
30
+ def self.config
31
+ @config ||= Config.new
32
+ end
33
+
34
+ def self.config=(configuration)
35
+ @config = configuration
36
+ end
37
+
38
+ def self.configure
39
+ yield config
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ module Fountain
2
+ module Papi
3
+ module Types
4
+ include Dry.Types()
5
+
6
+ UUID = Strict::String.
7
+ constrained(format: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fountain
4
+ module Papi
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-struct"
4
+ require "httparty"
5
+
6
+ require_relative "papi/config"
7
+ require_relative "papi/types"
8
+ require_relative "papi/version"
9
+ require_relative "papi/client"
10
+ require_relative "papi/applicant/create_status"
11
+ require_relative "papi/applicant/status"
12
+
13
+ module Fountain
14
+ module Papi
15
+ class Error < StandardError; end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fountain-papi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joey Cody
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-struct
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.20.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.20.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: 'Fountain''s Partner API for integrations. See more details: https://partners.fountain.com'
84
+ email:
85
+ - joeydcody@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - CHANGELOG.md
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - lib/fountain/papi.rb
99
+ - lib/fountain/papi/applicant/create_status.rb
100
+ - lib/fountain/papi/applicant/status.rb
101
+ - lib/fountain/papi/client.rb
102
+ - lib/fountain/papi/config.rb
103
+ - lib/fountain/papi/types.rb
104
+ - lib/fountain/papi/version.rb
105
+ homepage: https://github.com/onboardiq/fountain-papi
106
+ licenses:
107
+ - MIT
108
+ metadata:
109
+ homepage_uri: https://github.com/onboardiq/fountain-papi
110
+ source_code_uri: https://github.com/onboardiq/fountain-papi
111
+ changelog_uri: https://github.com/onboardiq/fountain-papi/CHANGELOG.md
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 2.6.0
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubygems_version: 3.2.32
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Ruby client for interfacing with Fountain Partners API.
131
+ test_files: []