mindmatch 0.0.1.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mind_match/client.rb +96 -0
- data/lib/mind_match/version.rb +3 -0
- data/lib/mind_match.rb +9 -0
- data/lib/mindmatch.rb +1 -0
- data/mindmatch.gemspec +31 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b006a3c20c79ac57bcec7f347a8b32d3503d279
|
4
|
+
data.tar.gz: eb599e3b6f95213534f7c3d7b798a13802295305
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c872ed1e8176a1084cbb933a88c46880e6a7cdb727e8a6fd30c59720a0e2f8df4eb3126351e71899b2fb321f8745d0a9c14541bc4c3b04910dc9fad1e938a47b
|
7
|
+
data.tar.gz: 0be642a46fc584e2c157f24fcf5be8a82540329bfe7abe8abc6f6acf0dbb7fd44f1d4b6bcbbd581b8970b820f4447a0d6096ece6fa4b8ef16345f4506294d236
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 duksis@gmail.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
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Hugo Duksis
|
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,56 @@
|
|
1
|
+
# MindMatch [![Build Status](https://travis-ci.org/mindmatch/mindmatch-ruby.svg?branch=master)](https://travis-ci.org/mindmatch/mindmatch-ruby)
|
2
|
+
|
3
|
+
MindMatch api client library for Ruby
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'mindmatch'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mindmatch
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'mindmatch'
|
25
|
+
|
26
|
+
mindmatch = MindMatch.new(token: ENV['MINDMATCH_TOKEN'])
|
27
|
+
match_id = mindmatch.create_match(
|
28
|
+
talents: [{"id" => 2, "name" => "John Snow", "email" => "js@winterfeld.uk",
|
29
|
+
"profileUrls" => ["https://linkedin.com/in/johnsnow"], "skills" => ["Javascript", "ruby"]}
|
30
|
+
],
|
31
|
+
position: {"mame" => "FE Developer", "description" => "Building a Ember aplication on a rails backend"}
|
32
|
+
)
|
33
|
+
#=> '6906ec3d-024d-43c6-a1cf-9b102eec4fb1'
|
34
|
+
mindmatch.query_match(id: match_id)
|
35
|
+
#=> {"id"=>"6906ec3d-024d-43c6-a1cf-9b102eec4fb1", "status"=>"fulfilled", "results"=>[{"score"=>0.1436655436}]}
|
36
|
+
```
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mindmatch/mindmatch-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
53
|
+
|
54
|
+
## Code of Conduct
|
55
|
+
|
56
|
+
Everyone interacting in the Mindmatch project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mindmatch/mindmatch-ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mindmatch"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module MindMatch
|
5
|
+
class Client
|
6
|
+
|
7
|
+
DEFAULT_ENDPOINT = 'https://api.mindmatch.ai/graphql'
|
8
|
+
|
9
|
+
def initialize(token:, endpoint: DEFAULT_ENDPOINT)
|
10
|
+
@conn = Faraday.new(:url => endpoint, :headers => {
|
11
|
+
"Authorization": "Bearer #{token}",
|
12
|
+
"Accept": "application/json",
|
13
|
+
"Content-Type": "application/json"
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_match(talents:, position:)
|
18
|
+
create_match_mutation = <<-GRAPHQL
|
19
|
+
mutation createMatch {
|
20
|
+
match: createMatch(
|
21
|
+
input: {
|
22
|
+
data: {
|
23
|
+
companies: [{
|
24
|
+
name: "company",
|
25
|
+
location: ["location"],
|
26
|
+
url: "http://example.com",
|
27
|
+
profileUrls: ["https://github.com/honeypotio", "https://linkedin.com/company/honeypot"],
|
28
|
+
positions: [#{positionql(position)}]
|
29
|
+
}],
|
30
|
+
people: [#{talents.map(&method(:talentql)).join(',')}]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
) {
|
34
|
+
id
|
35
|
+
}
|
36
|
+
}
|
37
|
+
GRAPHQL
|
38
|
+
|
39
|
+
raw_response = conn.post do |req|
|
40
|
+
req.body = JSON.generate(query: create_match_mutation)
|
41
|
+
end
|
42
|
+
response = JSON.parse(raw_response.body)
|
43
|
+
response['data']['match']['id']
|
44
|
+
end
|
45
|
+
|
46
|
+
def query_match(id:)
|
47
|
+
query_match_score = <<-GRAPHQL
|
48
|
+
query getMatch {
|
49
|
+
match: getMatch(id: "#{id}") {
|
50
|
+
id
|
51
|
+
status
|
52
|
+
data {
|
53
|
+
results {
|
54
|
+
score
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
GRAPHQL
|
60
|
+
|
61
|
+
raw_response = conn.get do |req|
|
62
|
+
req.body = JSON.generate(query: query_match_score)
|
63
|
+
end
|
64
|
+
response = JSON.parse(raw_response.body)
|
65
|
+
match = response.dig('data', 'match')
|
66
|
+
match = match['data'] if match.has_key?('data') # FIX: remove data namespece in mindmatch api
|
67
|
+
match
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
attr_reader :conn
|
72
|
+
|
73
|
+
def positionql(position)
|
74
|
+
<<-EOS.split.join(" ")
|
75
|
+
{
|
76
|
+
refId: "#{position['id']}",
|
77
|
+
name: "#{position['name']}",
|
78
|
+
description: "#{position['description']}"
|
79
|
+
}
|
80
|
+
EOS
|
81
|
+
end
|
82
|
+
|
83
|
+
def talentql(tal)
|
84
|
+
<<-EOS.split.join(" ")
|
85
|
+
{
|
86
|
+
refId: "#{tal['id']}",
|
87
|
+
name: "#{tal['name']}",
|
88
|
+
email: "#{tal['email']}",
|
89
|
+
profileUrls: #{tal['profileUrls']},
|
90
|
+
resumeUrl: "#{tal['resumeUrl']}",
|
91
|
+
skills: #{tal['skills']}
|
92
|
+
}
|
93
|
+
EOS
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/mind_match.rb
ADDED
data/lib/mindmatch.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "mind_match"
|
data/mindmatch.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "mind_match/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mindmatch"
|
8
|
+
spec.version = MindMatch::VERSION
|
9
|
+
spec.authors = ["MindMatch", "Hugo Duksis", "Kado Damball"]
|
10
|
+
spec.email = ["admin@mindmatch.ai", "duksis@gmail.com", "kadodamball@hotmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{MindMatch api client library for Ruby}
|
13
|
+
spec.description = %q{Api client library for Ruby based on the MindMatch graphql rest api}
|
14
|
+
spec.homepage = "https://github.com/mindmatch/mindmatch-ruby"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "faraday", "~> 0.13"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
29
|
+
spec.add_development_dependency "vcr", "~> 3.0"
|
30
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mindmatch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MindMatch
|
8
|
+
- Hugo Duksis
|
9
|
+
- Kado Damball
|
10
|
+
autorequire:
|
11
|
+
bindir: exe
|
12
|
+
cert_chain: []
|
13
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: faraday
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.13'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0.13'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: bundler
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '1.15'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.15'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rake
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '10.0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '10.0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '3.6'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.6'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: vcr
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: webmock
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '3.0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '3.0'
|
99
|
+
description: Api client library for Ruby based on the MindMatch graphql rest api
|
100
|
+
email:
|
101
|
+
- admin@mindmatch.ai
|
102
|
+
- duksis@gmail.com
|
103
|
+
- kadodamball@hotmail.com
|
104
|
+
executables: []
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CODE_OF_CONDUCT.md
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- lib/mind_match.rb
|
118
|
+
- lib/mind_match/client.rb
|
119
|
+
- lib/mind_match/version.rb
|
120
|
+
- lib/mindmatch.rb
|
121
|
+
- mindmatch.gemspec
|
122
|
+
homepage: https://github.com/mindmatch/mindmatch-ruby
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 1.3.1
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.5.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: MindMatch api client library for Ruby
|
146
|
+
test_files: []
|