mense 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 819a5059e9a7439d094e1cc66e930d76b5a4ca3c0fbf1dfb662521538100e617
4
+ data.tar.gz: c5df2c69229224d40c1d814226dc00fff6edaab982743b3920ec84a4e93fb8f6
5
+ SHA512:
6
+ metadata.gz: f9f4e74742b80d5116d67f1b3f673acb9aca752efb6ec35327aba63cc6a6d34a9da162158176f11fdccc4e35c246ce44a0de954d76bb85698aee3426457e1841
7
+ data.tar.gz: 5561c22920b0953024bfd6644c9cebc37a0e7362a5139bdb0862d0ab351b33e461bfe9022497654e42cc1484936f7e86ed5f3cb82315b0745724cd5d29233a2f
@@ -0,0 +1,40 @@
1
+ // See https://code.visualstudio.com/docs/remote/containers#_devcontainerjson-reference
2
+ {
3
+ // General ===================================================================
4
+ // A display name for the container.
5
+ "name": "Mense",
6
+ // A command string or list of command arguments to run after the container is
7
+ // created. The commands execute from the workspaceFolder in the container.
8
+ // Use && in a string to execute multiple commands. For example,
9
+ // "yarn install" or "apt-get update && apt-get install -y git". The array
10
+ // syntax ["yarn", "install"] will invoke the command (in this case yarn)
11
+ // directly without using a shell.
12
+ //
13
+ // It fires after your source code has been mounted, so you can also run shell
14
+ // scripts from your source tree. For example:
15
+ // bash scripts/install-dev-tools.sh. Not set by default.
16
+ // "postCreateCommand": "dev-entrypoint.sh check-node-modules-owner",
17
+ // Dockerfile Compose Config =================================================
18
+ // Required. Path or an ordered list of paths to Docker Compose files relative
19
+ // to the devcontainer.json file. Using an array is useful when extending your
20
+ // Docker Compose configuration. The order of the array matters since the
21
+ // contents of later files can override values set in previous ones.
22
+ "dockerComposeFile": [
23
+ "../docker-compose.yml" // The compose file with the common services
24
+ ],
25
+ "shutdownAction": "stopCompose",
26
+ // Required. The name of the service VS Code should connect to once running.
27
+ "service": "app",
28
+ "workspaceFolder": "/workspaces/mense",
29
+ // An array of extension IDs that specify the extensions to install inside the
30
+ // container when you first attach to it.
31
+ "extensions": [
32
+ "dbaeumer.vscode-eslint",
33
+ "rebornix.ruby",
34
+ "castwide.solargraph",
35
+ "miguel-savignano.ruby-symbols",
36
+ "redhat.vscode-xml",
37
+ "eamodio.gitlens",
38
+ "github.vscode-pull-request-github",
39
+ ]
40
+ }
data/.dockerignore ADDED
@@ -0,0 +1,27 @@
1
+ # Ignore version control files:
2
+ .git/
3
+ .gitignore
4
+
5
+ # Ignore github templates:
6
+ .github/
7
+
8
+ # Ignore docker and environment files:
9
+ *Dockerfile
10
+ docker-compose*.yml
11
+ **/*.env
12
+ .dockerignore
13
+
14
+ # Ignore OS artifacts:
15
+ **/.DS_Store
16
+ **/.Identifier
17
+
18
+
19
+ # 3: Ignore Development container's Home artifacts:
20
+ # 3.1: Ignore bash / IRB / Byebug history files
21
+ .*_hist*
22
+
23
+ # 3.3: bundler stuff
24
+ .bundle/*
25
+
26
+ # 3.4: Codeclimate stuff:
27
+ .rubocop.yml
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.2
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.15
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -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
+ .env
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.4
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] - 2021-11-23
4
+
5
+ - Initial release
@@ -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 kurenn@icalialabs.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/Dockerfile ADDED
@@ -0,0 +1,91 @@
1
+ # Stage 1: Runtime =============================================================
2
+ # The minimal package dependencies required to run the app in the release image:
3
+
4
+ # Use the official Ruby 3.0.2 Slim Buster image as base:
5
+ FROM ruby:3.0.2-slim-buster
6
+
7
+ # We'll set MALLOC_ARENA_MAX for optimization purposes & prevent memory bloat
8
+ # https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html
9
+ ENV MALLOC_ARENA_MAX="2"
10
+
11
+ # Install the app build system dependency packages:
12
+ RUN apt-get update \
13
+ && apt-get install -y --no-install-recommends \
14
+ build-essential \
15
+ git
16
+
17
+ # Receive the developer user's UID and USER:
18
+ ARG DEVELOPER_UID=1000
19
+ ARG DEVELOPER_USERNAME=you
20
+
21
+ # Replicate the developer user in the development image:
22
+ RUN addgroup --gid ${DEVELOPER_UID} ${DEVELOPER_USERNAME} \
23
+ ; useradd -r -m -u ${DEVELOPER_UID} --gid ${DEVELOPER_UID} \
24
+ --shell /bin/bash -c "Developer User,,," ${DEVELOPER_USERNAME}
25
+
26
+ # Ensure the developer user's home directory and app path are owned by him/her:
27
+ # (A workaround to a side effect of setting WORKDIR before creating the user)
28
+ RUN userhome=$(eval echo ~${DEVELOPER_USERNAME}) \
29
+ && chown -R ${DEVELOPER_USERNAME}:${DEVELOPER_USERNAME} $userhome \
30
+ && mkdir -p /workspaces/mense \
31
+ && chown -R ${DEVELOPER_USERNAME}:${DEVELOPER_USERNAME} /workspaces/mense
32
+
33
+ # Set the app path as the working directory:
34
+ WORKDIR /workspaces/mense
35
+
36
+ # Change to the developer user:
37
+ USER ${DEVELOPER_USERNAME}
38
+
39
+ # Copy the project's Gemfile and Gemfile.lock files:
40
+ COPY --chown=${DEVELOPER_USERNAME} Gemfile* /workspaces/mense/
41
+
42
+ # Install the gems in the Gemfile, except for the ones in the "development"
43
+ # group, which shouldn't be required in order to run the tests with the leanest
44
+ # Docker image possible:
45
+ RUN bundle install --jobs=4 --retry=3
46
+
47
+ # Receive the developer username again, as ARGS won't persist between stages on
48
+ # non-buildkit builds:
49
+ ARG DEVELOPER_USERNAME=you
50
+
51
+ # Change to root user to install the development packages:
52
+ USER root
53
+
54
+ # Install sudo, along with any other tool required at development phase:
55
+ RUN apt-get install -y --no-install-recommends \
56
+ # Adding bash autocompletion as git without autocomplete is a pain...
57
+ bash-completion \
58
+ # gpg & gpgconf is used to get Git Commit GPG Signatures working inside the
59
+ # VSCode devcontainer:
60
+ gpg \
61
+ openssh-client \
62
+ # Para esperar a que el servicio de minio (u otros) esté disponible:
63
+ netcat \
64
+ # /proc file system utilities: (watch, ps):
65
+ procps \
66
+ # Vim will be used to edit files when inside the container (git, etc):
67
+ vim \
68
+ # Sudo will be used to install/configure system stuff if needed during dev:
69
+ sudo
70
+
71
+ # Add the developer user to the sudoers list:
72
+ RUN echo "${DEVELOPER_USERNAME} ALL=(ALL) NOPASSWD:ALL" | tee "/etc/sudoers.d/${DEVELOPER_USERNAME}"
73
+
74
+ # Persist the bash history between runs
75
+ # - See https://code.visualstudio.com/docs/remote/containers-advanced#_persist-bash-history-between-runs
76
+ RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/command-history/.bash_history" \
77
+ && mkdir /command-history \
78
+ && touch /command-history/.bash_history \
79
+ && chown -R ${DEVELOPER_USERNAME} /command-history \
80
+ && echo $SNIPPET >> "/home/${DEVELOPER_USERNAME}/.bashrc"
81
+
82
+ # Create the extensions directories:
83
+ RUN mkdir -p \
84
+ /home/${DEVELOPER_USERNAME}/.vscode-server/extensions \
85
+ /home/${DEVELOPER_USERNAME}/.vscode-server-insiders/extensions \
86
+ && chown -R ${DEVELOPER_USERNAME} \
87
+ /home/${DEVELOPER_USERNAME}/.vscode-server \
88
+ /home/${DEVELOPER_USERNAME}/.vscode-server-insiders
89
+
90
+ # Change back to the developer user:
91
+ USER ${DEVELOPER_USERNAME}
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 13.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "httparty"
8
+ gem 'hashie'
9
+
10
+ group :development do
11
+ gem "rubocop", "~> 1.7"
12
+ gem "solargraph"
13
+ gem 'pry'
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,97 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.4.2)
5
+ backport (1.2.0)
6
+ benchmark (0.2.0)
7
+ coderay (1.1.3)
8
+ diff-lcs (1.4.4)
9
+ e2mmap (0.1.0)
10
+ hashie (5.0.0)
11
+ httparty (0.20.0)
12
+ mime-types (~> 3.0)
13
+ multi_xml (>= 0.5.2)
14
+ jaro_winkler (1.5.4)
15
+ kramdown (2.3.1)
16
+ rexml
17
+ kramdown-parser-gfm (1.1.0)
18
+ kramdown (~> 2.0)
19
+ method_source (1.0.0)
20
+ mime-types (3.4.1)
21
+ mime-types-data (~> 3.2015)
22
+ mime-types-data (3.2021.1115)
23
+ multi_xml (0.6.0)
24
+ nokogiri (1.12.5-x86_64-linux)
25
+ racc (~> 1.4)
26
+ parallel (1.20.1)
27
+ parser (3.0.1.0)
28
+ ast (~> 2.4.1)
29
+ pry (0.14.1)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ racc (1.6.0)
33
+ rainbow (3.0.0)
34
+ rake (13.0.3)
35
+ regexp_parser (2.1.1)
36
+ reverse_markdown (2.1.1)
37
+ nokogiri
38
+ rexml (3.2.5)
39
+ rspec (3.10.0)
40
+ rspec-core (~> 3.10.0)
41
+ rspec-expectations (~> 3.10.0)
42
+ rspec-mocks (~> 3.10.0)
43
+ rspec-core (3.10.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-expectations (3.10.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-mocks (3.10.2)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-support (3.10.2)
52
+ rubocop (1.12.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 3.0.0.0)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml
58
+ rubocop-ast (>= 1.2.0, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 3.0)
61
+ rubocop-ast (1.4.1)
62
+ parser (>= 2.7.1.5)
63
+ ruby-progressbar (1.11.0)
64
+ solargraph (0.44.2)
65
+ backport (~> 1.2)
66
+ benchmark
67
+ bundler (>= 1.17.2)
68
+ diff-lcs (~> 1.4)
69
+ e2mmap
70
+ jaro_winkler (~> 1.5)
71
+ kramdown (~> 2.3)
72
+ kramdown-parser-gfm (~> 1.1)
73
+ parser (~> 3.0)
74
+ reverse_markdown (>= 1.0.5, < 3)
75
+ rubocop (>= 0.52)
76
+ thor (~> 1.0)
77
+ tilt (~> 2.0)
78
+ yard (~> 0.9, >= 0.9.24)
79
+ thor (1.1.0)
80
+ tilt (2.0.10)
81
+ unicode-display_width (2.0.0)
82
+ yard (0.9.26)
83
+
84
+ PLATFORMS
85
+ x86_64-linux
86
+
87
+ DEPENDENCIES
88
+ hashie
89
+ httparty
90
+ pry
91
+ rake (~> 13.0)
92
+ rspec (~> 3.0)
93
+ rubocop (~> 1.7)
94
+ solargraph
95
+
96
+ BUNDLED WITH
97
+ 2.2.22
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Abraham Kuri
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,43 @@
1
+ # Mense
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mense`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'mense'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install mense
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mense. 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/[USERNAME]/mense/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Mense project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/mense/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
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
+ task default: %i[spec]
data/bin/console ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require_relative "../lib/mense"
6
+
7
+ Mense.configure do |config|
8
+ config.api_key = ENV['PEOPLE_DATA_LABS_API_KEY']
9
+ end
10
+
11
+ # You can add fixtures and/or initialization code here to make experimenting
12
+ # with your gem easier. You can also use a different console, if you like.
13
+
14
+ # (If you use this, don't forget to add pry to your Gemfile!)
15
+ require "pry"
16
+ Pry.start
17
+
18
+ # require "irb"
19
+ # IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ version: "3.7"
2
+
3
+ volumes:
4
+ gem_bundle: # Used to store the app's gem libraries...
5
+
6
+ services:
7
+ # The test container - we'll use this as the base for the rest
8
+ # of the app service definitions:
9
+ app: &app
10
+ build:
11
+ context: .
12
+ dockerfile: Dockerfile
13
+ args:
14
+ DEVELOPER_UID: ${UID:-1000}
15
+ DEVELOPER_USERNAME: ${USER:-you}
16
+ image: coba/mense:development
17
+ volumes:
18
+ # Mount the app code into the app containers:
19
+ - .:/workspaces/mense
20
+
21
+ # After mounting the app code, we will use volumes to store the project's
22
+ # gem libraries and node modules.
23
+
24
+ # In the case of the gem libraries, the "gem_bundle" volume will be
25
+ # initialized with the development image's installed gems. Gems can be
26
+ # added later during the development process without re-building the
27
+ # development image:
28
+ - gem_bundle:/usr/local/bundle
29
+ # Keep the stdin open, so we can attach to our app container's process
30
+ # and do things such as byebug, etc:
31
+ stdin_open: true
32
+
33
+ # Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
34
+ tty: true
35
+ env_file: .env
data/lib/mense/base.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hashie'
4
+
5
+ module Mense
6
+ class Base < Hash
7
+ include Hashie::Extensions::MergeInitializer
8
+ include Hashie::Extensions::IndifferentAccess
9
+ include Hashie::Extensions::MethodReader
10
+ include Hashie::Extensions::DeepMerge
11
+ include Hashie::Extensions::Coercion
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+
5
+ module Mense
6
+ module Client
7
+ def self.included(base)
8
+ base.include HTTParty
9
+
10
+ base.base_uri "https://api.peopledatalabs.com/v5"
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mense
4
+ class Company < Mense::Base
5
+ class Location < Mense::Base; end
6
+
7
+ coerce_key :location, Mense::Company::Location
8
+
9
+ include Mense::Client
10
+
11
+ def self.enrich(params = {})
12
+ response = get('/company/enrich', query: params, headers: { "X-API-Key" => Mense.api_key,
13
+ "Content-Type" => "application/json"})
14
+
15
+ self.new(response)
16
+ end
17
+
18
+ def self.clean(params = {})
19
+ response = get('/company/clean', query: params, headers: { "X-API-Key" => Mense.api_key,
20
+ "Content-Type" => "application/json"})
21
+
22
+ self.new(response)
23
+ end
24
+
25
+ def self.search(params = {})
26
+ response = get("/company/search", query: params, headers: { "X-API-Key" => Mense.api_key,
27
+ "Content-Type" => "application/json"})
28
+
29
+ response
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mense
4
+ class Education < Mense::Base
5
+
6
+ class School < Mense::Base
7
+ class Location < Mense::Base; end
8
+ coerce_key :location, Location
9
+ end
10
+
11
+ coerce_key :school, School
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mense
4
+ class Experience < Mense::Base
5
+
6
+ class Company < Mense::Base
7
+ class Location < Mense::Base; end
8
+ coerce_key :location, Location
9
+ end
10
+
11
+ coerce_key :company, Company
12
+ end
13
+ end
@@ -0,0 +1,49 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ require_relative 'experience'
5
+ require_relative 'education'
6
+ require_relative 'profile'
7
+
8
+ module Mense
9
+ class Person < Mense::Base
10
+ class Email < Mense::Base; end
11
+
12
+ coerce_key :experience, Array[Mense::Experience]
13
+ coerce_key :education, Array[Mense::Education]
14
+ coerce_key :profiles, Array[Mense::Profile]
15
+ coerce_key :emails, Array[Mense::Person::Email]
16
+
17
+ include Mense::Client
18
+
19
+ attr_reader :likelihood
20
+
21
+ def initialize(attributes = {})
22
+ @likelihood = attributes["likelihood"]
23
+ super(attributes["data"])
24
+ end
25
+
26
+ def self.enrich(params = {})
27
+ response = get('/person/enrich', query: params, headers: { "X-API-Key" => Mense.api_key })
28
+
29
+ self.new(response)
30
+ end
31
+
32
+ def self.search(params = {})
33
+ response = get("/person/search", query: params, headers: { "X-API-Key" => Mense.api_key,
34
+ "Content-Type" => "application/json"})
35
+
36
+ response
37
+ end
38
+
39
+ def self.retrieve(id, params = {})
40
+ response = get("/person/retrieve/#{id}", query: params, headers: { "X-API-Key" => Mense.api_key })
41
+
42
+ self.new(response)
43
+ end
44
+
45
+ class <<self
46
+ alias_method :find, :retrieve
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mense
4
+ class Profile < Mense::Base; end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mense
4
+ VERSION = "0.1.0"
5
+ end
data/lib/mense.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "mense/version"
4
+
5
+ module Mense
6
+
7
+ @@api_key = nil
8
+
9
+ def self.api_key=(api_key)
10
+ @@api_key = api_key
11
+ end
12
+
13
+ def self.api_key
14
+ @@api_key
15
+ end
16
+
17
+ def self.configure
18
+ yield self
19
+ end
20
+ end
21
+
22
+ require 'pry'
23
+ require_relative 'mense/client'
24
+ require_relative 'mense/base'
25
+ require_relative 'mense/person'
26
+ require_relative 'mense/company'
data/mense.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require_relative "lib/mense/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "mense"
9
+ spec.version = Mense::VERSION
10
+ spec.authors = ["Abraham Kuri"]
11
+ spec.email = ["abkuri88@gmail.com"]
12
+
13
+ spec.summary = "A wrapper for the People Data Labs API"
14
+ spec.description = "A wrapper for the People Data Labs API"
15
+ spec.homepage = "https://github.com/kurenn/mense"
16
+ spec.license = "MIT"
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
18
+
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/kurenn/mense"
23
+ spec.metadata["changelog_uri"] = "https://github.com/kurenn/mense/blob/master/CHANGELOG.md"
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+
37
+ # For more information and examples about making a new gem, checkout our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mense
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Abraham Kuri
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A wrapper for the People Data Labs API
14
+ email:
15
+ - abkuri88@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".devcontainer/devcontainer.json"
21
+ - ".dockerignore"
22
+ - ".github/workflows/main.yml"
23
+ - ".gitignore"
24
+ - ".rspec"
25
+ - ".rubocop.yml"
26
+ - CHANGELOG.md
27
+ - CODE_OF_CONDUCT.md
28
+ - Dockerfile
29
+ - Gemfile
30
+ - Gemfile.lock
31
+ - LICENSE.txt
32
+ - README.md
33
+ - Rakefile
34
+ - bin/console
35
+ - bin/setup
36
+ - docker-compose.yml
37
+ - lib/mense.rb
38
+ - lib/mense/base.rb
39
+ - lib/mense/client.rb
40
+ - lib/mense/company.rb
41
+ - lib/mense/education.rb
42
+ - lib/mense/experience.rb
43
+ - lib/mense/person.rb
44
+ - lib/mense/profile.rb
45
+ - lib/mense/version.rb
46
+ - mense.gemspec
47
+ homepage: https://github.com/kurenn/mense
48
+ licenses:
49
+ - MIT
50
+ metadata:
51
+ allowed_push_host: https://rubygems.org
52
+ homepage_uri: https://github.com/kurenn/mense
53
+ source_code_uri: https://github.com/kurenn/mense
54
+ changelog_uri: https://github.com/kurenn/mense/blob/master/CHANGELOG.md
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.4.0
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubygems_version: 3.2.22
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: A wrapper for the People Data Labs API
74
+ test_files: []