remoteok 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +59 -0
- data/.rspec +3 -0
- data/.rspec_status +30 -0
- data/.rubocop.yml +20 -0
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +78 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +303 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/remoteok.rb +8 -0
- data/lib/remoteok/client.rb +56 -0
- data/lib/remoteok/job.rb +88 -0
- data/lib/remoteok/version.rb +5 -0
- data/remoteok.gemspec +40 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a9e942950938b25e561c843c947dcd9cda7161873276ecb6253f90121b4f530
|
4
|
+
data.tar.gz: bfd224660f998c2fd03e73e8de447e6e93312c10c9216f62742f3683b06c91f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3defc05518c18951df4590cbdfc821ef151c2077527beddf2ac01a3f8538904da0e28c6fac897a96e243c2924cc8658b14ea64d91b3d0f10a65cd48a3b85f697
|
7
|
+
data.tar.gz: 100480951b824b5b5aad56207f90785455436eb87376cca267c3c955f4a0602f2bf50288a6b7649818b262fbd6ce57546ee78f0ba0691a531d6b93cdbb32385c
|
@@ -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: 3.0.1
|
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,59 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
57
|
+
|
58
|
+
# Coverage information from SimpleCov
|
59
|
+
coverage
|
data/.rspec
ADDED
data/.rspec_status
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
--------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/remoteok/client_spec.rb[1:1] | passed | 0.00902 seconds |
|
4
|
+
./spec/remoteok/client_spec.rb[1:2:1] | passed | 0.00061 seconds |
|
5
|
+
./spec/remoteok/client_spec.rb[1:2:2:1] | passed | 0.00042 seconds |
|
6
|
+
./spec/remoteok/client_spec.rb[1:3:1] | passed | 0.00042 seconds |
|
7
|
+
./spec/remoteok/client_spec.rb[1:4:1] | passed | 0.00128 seconds |
|
8
|
+
./spec/remoteok/client_spec.rb[1:4:2] | passed | 0.00042 seconds |
|
9
|
+
./spec/remoteok/client_spec.rb[1:5:1] | passed | 0.00096 seconds |
|
10
|
+
./spec/remoteok/client_spec.rb[1:5:2] | passed | 0.00124 seconds |
|
11
|
+
./spec/remoteok/client_spec.rb[1:5:3:1] | passed | 0.00045 seconds |
|
12
|
+
./spec/remoteok/client_spec.rb[1:5:4:1] | passed | 0.00058 seconds |
|
13
|
+
./spec/remoteok/job_spec.rb[1:1] | passed | 0.00041 seconds |
|
14
|
+
./spec/remoteok/job_spec.rb[1:2:1] | passed | 0.00019 seconds |
|
15
|
+
./spec/remoteok/job_spec.rb[1:3:1] | passed | 0.00019 seconds |
|
16
|
+
./spec/remoteok/job_spec.rb[1:4:1] | passed | 0.00019 seconds |
|
17
|
+
./spec/remoteok/job_spec.rb[1:5:1] | passed | 0.00019 seconds |
|
18
|
+
./spec/remoteok/job_spec.rb[1:6:1] | passed | 0.00066 seconds |
|
19
|
+
./spec/remoteok/job_spec.rb[1:7:1] | passed | 0.0002 seconds |
|
20
|
+
./spec/remoteok/job_spec.rb[1:8:1] | passed | 0.00031 seconds |
|
21
|
+
./spec/remoteok/job_spec.rb[1:9:1] | passed | 0.00027 seconds |
|
22
|
+
./spec/remoteok/job_spec.rb[1:10:1] | passed | 0.00023 seconds |
|
23
|
+
./spec/remoteok/job_spec.rb[1:11:1] | passed | 0.00028 seconds |
|
24
|
+
./spec/remoteok/job_spec.rb[1:12:1] | passed | 0.00024 seconds |
|
25
|
+
./spec/remoteok/job_spec.rb[1:13:1] | passed | 0.00035 seconds |
|
26
|
+
./spec/remoteok/job_spec.rb[1:14:1] | passed | 0.0003 seconds |
|
27
|
+
./spec/remoteok/job_spec.rb[1:15:1] | passed | 0.00032 seconds |
|
28
|
+
./spec/remoteok/job_spec.rb[1:16:1] | passed | 0.01251 seconds |
|
29
|
+
./spec/remoteok/job_spec.rb[1:17:1] | passed | 0.00037 seconds |
|
30
|
+
./spec/remoteok_spec.rb[1:1] | passed | 0.00017 seconds |
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 2.6
|
4
|
+
|
5
|
+
Style/StringLiterals:
|
6
|
+
Enabled: true
|
7
|
+
EnforcedStyle: single_quotes
|
8
|
+
|
9
|
+
Style/StringLiteralsInInterpolation:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 120
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Exclude:
|
18
|
+
- 'Rakefile'
|
19
|
+
- '**/*.rake'
|
20
|
+
- 'spec/**/*.rb'
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 768254+RemoteCTO@users.noreply.github.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,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in remoteok.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'rake', '~> 13.0'
|
9
|
+
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
|
+
|
12
|
+
gem 'rubocop', '~> 1.7'
|
13
|
+
gem 'rubocop-rake'
|
14
|
+
gem 'rubocop-rspec'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
remoteok (0.1.0)
|
5
|
+
httparty (~> 0.18.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
docile (1.3.5)
|
13
|
+
httparty (0.18.1)
|
14
|
+
mime-types (~> 3.0)
|
15
|
+
multi_xml (>= 0.5.2)
|
16
|
+
json (2.5.1)
|
17
|
+
mime-types (3.3.1)
|
18
|
+
mime-types-data (~> 3.2015)
|
19
|
+
mime-types-data (3.2021.0225)
|
20
|
+
multi_xml (0.6.0)
|
21
|
+
parallel (1.20.1)
|
22
|
+
parser (3.0.1.1)
|
23
|
+
ast (~> 2.4.1)
|
24
|
+
rainbow (3.0.0)
|
25
|
+
rake (13.0.3)
|
26
|
+
regexp_parser (2.1.1)
|
27
|
+
rexml (3.2.5)
|
28
|
+
rspec (3.10.0)
|
29
|
+
rspec-core (~> 3.10.0)
|
30
|
+
rspec-expectations (~> 3.10.0)
|
31
|
+
rspec-mocks (~> 3.10.0)
|
32
|
+
rspec-core (3.10.1)
|
33
|
+
rspec-support (~> 3.10.0)
|
34
|
+
rspec-expectations (3.10.1)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.10.0)
|
37
|
+
rspec-mocks (3.10.2)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.10.0)
|
40
|
+
rspec-support (3.10.2)
|
41
|
+
rubocop (1.13.0)
|
42
|
+
parallel (~> 1.10)
|
43
|
+
parser (>= 3.0.0.0)
|
44
|
+
rainbow (>= 2.2.2, < 4.0)
|
45
|
+
regexp_parser (>= 1.8, < 3.0)
|
46
|
+
rexml
|
47
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
48
|
+
ruby-progressbar (~> 1.7)
|
49
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
50
|
+
rubocop-ast (1.5.0)
|
51
|
+
parser (>= 3.0.1.1)
|
52
|
+
rubocop-rake (0.5.1)
|
53
|
+
rubocop
|
54
|
+
rubocop-rspec (2.3.0)
|
55
|
+
rubocop (~> 1.0)
|
56
|
+
rubocop-ast (>= 1.1.0)
|
57
|
+
ruby-progressbar (1.11.0)
|
58
|
+
simplecov (0.17.1)
|
59
|
+
docile (~> 1.1)
|
60
|
+
json (>= 1.8, < 3)
|
61
|
+
simplecov-html (~> 0.10.0)
|
62
|
+
simplecov-html (0.10.2)
|
63
|
+
unicode-display_width (2.0.0)
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
x86_64-darwin-19
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
rake (~> 13.0)
|
70
|
+
remoteok!
|
71
|
+
rspec (~> 3.0)
|
72
|
+
rubocop (~> 1.7)
|
73
|
+
rubocop-rake
|
74
|
+
rubocop-rspec
|
75
|
+
simplecov (< 0.18)
|
76
|
+
|
77
|
+
BUNDLED WITH
|
78
|
+
2.2.15
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Ed Woodcock
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Edward Woodcock
|
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,303 @@
|
|
1
|
+
# RemoteOK API Ruby Client
|
2
|
+
|
3
|
+
A ruby client to interact with the <a href="https://remoteok.io" target="_blank">RemoteOK</a> API.
|
4
|
+
|
5
|
+
<a href="https://codeclimate.com/github/RemoteCTO/remote-ok-ruby/maintainability"><img src="https://api.codeclimate.com/v1/badges/b60f02bbaa5fd337e0cf/maintainability" /></a>
|
6
|
+
|
7
|
+
<a href="https://codeclimate.com/github/RemoteCTO/remote-ok-ruby/test_coverage"><img src="https://api.codeclimate.com/v1/badges/b60f02bbaa5fd337e0cf/test_coverage" /></a>
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
#### Requirements
|
12
|
+
|
13
|
+
- Ruby >= 2.6.0
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'remoteok'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle install
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install remoteok
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
### Authentication
|
32
|
+
|
33
|
+
RemoteOK does not currently require direct authentication, rather simply exists as a JSON document at the url:
|
34
|
+
|
35
|
+
> <a href="https://remoteok.io/api" target="_blank">https://remoteok.io/api</a>
|
36
|
+
|
37
|
+
### Delayed Items & Legal
|
38
|
+
|
39
|
+
Items in the API are available 24 hours later than on the web. It is important to note that this document contains it's own legal terms within it, which at the time of writing are:
|
40
|
+
|
41
|
+
> API Terms of Service: Please link back to the URL on Remote OK and mention Remote OK as a source, so we get traffic back from your site. If you do not we'll have to suspend API access.
|
42
|
+
|
43
|
+
> Please don't use the Remote OK logo without written permission as they're registered trademarks, please DO use our name Remote OK though
|
44
|
+
|
45
|
+
> The API feed at \/api is delayed by 24 hours so that Google knows it's Remote OK first posting the job to avoid duplicate content problems, if you'd like to advertise or pay for instant API access for all remote jobs (minimum budget $10k\/mo), contact <a href="https://twitter.com/remoteok" target="_blank">@remoteok</a> on Twitter."
|
46
|
+
|
47
|
+
You can fetch a realtime version of this document by using
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
RemoteOK::Client.new.legal # => String of legal copy.
|
51
|
+
```
|
52
|
+
|
53
|
+
### Getting Started
|
54
|
+
|
55
|
+
The gem works through a client object which needs instantiation, and call methods exist on this client.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
client = RemoteOK::Client.new
|
59
|
+
```
|
60
|
+
|
61
|
+
<hr>
|
62
|
+
|
63
|
+
### Client Config
|
64
|
+
|
65
|
+
The client has a number of configurable options set during instantiation. Multiple options may be provided.
|
66
|
+
|
67
|
+
#### `user_agent`
|
68
|
+
|
69
|
+
The gem will send it's own default user agent but you can override it for your own app.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
client = RemoteOK::Client.new(user_agent: 'hello-there')
|
73
|
+
```
|
74
|
+
|
75
|
+
#### `debug`
|
76
|
+
|
77
|
+
Turning on the debug flag will pass a request to HTTParty to print verbose debug output to the console, so that you can inspect whats happening on the network under the hood.
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
client = RemoteOK::Client.new(debug: true)
|
81
|
+
```
|
82
|
+
|
83
|
+
### Client Methods
|
84
|
+
|
85
|
+
#### `.jobs`
|
86
|
+
|
87
|
+
Items are returned as an array of `RemoteOK::Job` objects.
|
88
|
+
|
89
|
+
**Important:** These items are cached in the client once fetched to avoid excessive calls to the live site, make sure to use the [#with_fetch](#with_fetch) method to force a refresh.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
client.jobs # => [Job, Job, Job]
|
93
|
+
```
|
94
|
+
|
95
|
+
##### Tag Searching
|
96
|
+
|
97
|
+
You can specify specific tags that you'd like the RemoteOK API to search by through tag arguments to the `.jobs` method.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
client.jobs :ruby, :digital_nomad
|
101
|
+
```
|
102
|
+
|
103
|
+
This will return all jobs that match on Ruby **OR** Digital Nomad.
|
104
|
+
|
105
|
+
#### `.with_fetch`
|
106
|
+
|
107
|
+
A chainable method to force the client to fetch items from the live site rather than using the cached information.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
client.with_fetch.jobs # => [Job, Job, Job]
|
111
|
+
```
|
112
|
+
|
113
|
+
<hr>
|
114
|
+
|
115
|
+
### Job methods
|
116
|
+
|
117
|
+
Jobs are retrieved from the jobs array.
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
job = client.jobs.first
|
121
|
+
```
|
122
|
+
|
123
|
+
#### `.raw`
|
124
|
+
|
125
|
+
Type: `JSON`
|
126
|
+
|
127
|
+
Returns the raw JSON data associated with the job directly from the API.
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
job.raw # => {...}
|
131
|
+
```
|
132
|
+
|
133
|
+
#### `.slug`
|
134
|
+
|
135
|
+
Type: `String`
|
136
|
+
|
137
|
+
Returns the job url slug.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
job.slug # => "i-am-a-job-slug"
|
141
|
+
```
|
142
|
+
|
143
|
+
#### `.id`
|
144
|
+
|
145
|
+
Type: `Integer`
|
146
|
+
|
147
|
+
Returns the job id.
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
job.id # => 123456
|
151
|
+
```
|
152
|
+
|
153
|
+
#### `.epoch`
|
154
|
+
|
155
|
+
Type: `Integer`
|
156
|
+
|
157
|
+
Returns the posting epoch as an integer.
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
job.epoch # => 1_619_724_426
|
161
|
+
```
|
162
|
+
|
163
|
+
#### `.date`
|
164
|
+
|
165
|
+
Type: `DateTime`
|
166
|
+
|
167
|
+
Returns the creation date of the job as a DateTime object.
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
job.date # => DateTime<...>
|
171
|
+
```
|
172
|
+
|
173
|
+
#### `.company`
|
174
|
+
|
175
|
+
Type: `String`
|
176
|
+
|
177
|
+
Returns the name of the company the job is for.
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
job.company # => "Awesome Company"
|
181
|
+
```
|
182
|
+
|
183
|
+
#### `.company_logo`
|
184
|
+
|
185
|
+
Type: `String`
|
186
|
+
|
187
|
+
Returns RemoteOK URL for the company logo.
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
job.company_logo # => "https://remoteOK.io/assets/jobs/something.png"
|
191
|
+
```
|
192
|
+
|
193
|
+
#### `.position`
|
194
|
+
|
195
|
+
Type: `String`
|
196
|
+
|
197
|
+
Returns name of the position (job title)
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
job.position # => "Chief Awesome Officer"
|
201
|
+
```
|
202
|
+
|
203
|
+
#### `.tags`
|
204
|
+
|
205
|
+
Type: `Array`
|
206
|
+
|
207
|
+
Returns all the tags associated for the job as symbols. These can also be used for searching and filtering the API.
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
job.tags # => [:dev, :dot_net, :digital_nomad]
|
211
|
+
```
|
212
|
+
|
213
|
+
#### `.logo`
|
214
|
+
|
215
|
+
Type: `String`
|
216
|
+
|
217
|
+
String URL of logo associated with the job.
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
job.logo # => "https://remoteOK.io/assets/jobs/jobjob.png"
|
221
|
+
```
|
222
|
+
|
223
|
+
#### `.description`
|
224
|
+
|
225
|
+
Type: `String`
|
226
|
+
|
227
|
+
A string containing the job description, directly as it's stored in Remote OK. Be aware that this will likely contain HTML code in the content.
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
job.description # => "<p><strong>Our Company</strong>...."
|
231
|
+
```
|
232
|
+
|
233
|
+
#### `.description_text`
|
234
|
+
|
235
|
+
Type: `String`
|
236
|
+
|
237
|
+
A best-attempt to extract the raw text from the above, removing HTML tags and formatting.
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
job.description_text # => "Our Company...."
|
241
|
+
```
|
242
|
+
|
243
|
+
#### `.location`
|
244
|
+
|
245
|
+
Type: `String`
|
246
|
+
|
247
|
+
Written global location for the job.
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
job.location # => "North America"
|
251
|
+
```
|
252
|
+
|
253
|
+
#### `.original`
|
254
|
+
|
255
|
+
Type: `Boolean`
|
256
|
+
|
257
|
+
Flag for whether it's an original job post
|
258
|
+
|
259
|
+
```ruby
|
260
|
+
job.original # => true
|
261
|
+
```
|
262
|
+
|
263
|
+
#### `.url`
|
264
|
+
|
265
|
+
Type: `String`
|
266
|
+
|
267
|
+
String URL to the job post on RemoteOK itself
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
job.url # => "https://remoteOK.io/remote-jobs/somejob"
|
271
|
+
```
|
272
|
+
|
273
|
+
#### `.apply_url`
|
274
|
+
|
275
|
+
Type: `String`
|
276
|
+
|
277
|
+
String URL for candidates to apply to the job
|
278
|
+
|
279
|
+
```ruby
|
280
|
+
job.apply_url # => "https://remoteOK.io/remote-jobs/l/somejob"
|
281
|
+
```
|
282
|
+
|
283
|
+
<hr>
|
284
|
+
|
285
|
+
## Development
|
286
|
+
|
287
|
+
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.
|
288
|
+
|
289
|
+
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).
|
290
|
+
|
291
|
+
<hr>
|
292
|
+
|
293
|
+
## Contributing
|
294
|
+
|
295
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/RemoteCTO/remoteok. 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/RemoteCTO/remoteok/blob/master/CODE_OF_CONDUCT.md).
|
296
|
+
|
297
|
+
## License
|
298
|
+
|
299
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
300
|
+
|
301
|
+
## Code of Conduct
|
302
|
+
|
303
|
+
Everyone interacting in the Remoteok project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/RemoteCTO/remoteok/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'remoteok'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/remoteok.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RemoteOK
|
4
|
+
# Client class to interact with the API itself
|
5
|
+
class Client
|
6
|
+
require 'json'
|
7
|
+
require 'httparty'
|
8
|
+
require_relative 'job'
|
9
|
+
|
10
|
+
include HTTParty
|
11
|
+
|
12
|
+
def initialize(**config)
|
13
|
+
@base_url = config[:base_url] || 'https://remoteok.io/api'
|
14
|
+
@debug = config[:debug] || false
|
15
|
+
@user_agent = config[:user_agent] || default_user_agent
|
16
|
+
end
|
17
|
+
|
18
|
+
def with_fetch(params = {})
|
19
|
+
options = { headers: { 'User-Agent' => @user_agent } }
|
20
|
+
options[:query] = params if params&.any?
|
21
|
+
options[:debug_output] = $stdout if @debug
|
22
|
+
|
23
|
+
response = self.class.get @base_url, options
|
24
|
+
|
25
|
+
@data = JSON.parse(response.body)
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def legal
|
30
|
+
with_fetch unless @data
|
31
|
+
@data.first['legal']
|
32
|
+
end
|
33
|
+
|
34
|
+
def jobs(*tags)
|
35
|
+
options = { tags: stringify(tags) } if tags&.any?
|
36
|
+
|
37
|
+
with_fetch options unless @data
|
38
|
+
|
39
|
+
return unless @data.any?
|
40
|
+
|
41
|
+
@data[1..].map { |job_data| RemoteOK::Job.new(job_data) }
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def stringify(tags = [])
|
47
|
+
return unless tags.any?
|
48
|
+
|
49
|
+
tags.map { |tag| tag.to_s.gsub('_', ' ') }.join ','
|
50
|
+
end
|
51
|
+
|
52
|
+
def default_user_agent
|
53
|
+
"remote-ok-ruby/#{RemoteOK::VERSION} +http://github.com/RemoteCTO/remote-ok-ruby"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/remoteok/job.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RemoteOK
|
4
|
+
# Class representing a single job from RemoteOK with data accessors.
|
5
|
+
class Job
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
attr_reader :raw
|
9
|
+
|
10
|
+
HTML_CHARS_REGEX = /<("[^"]*"|'[^']*'|[^'">])*>/.freeze
|
11
|
+
|
12
|
+
def initialize(job_data)
|
13
|
+
@raw = job_data
|
14
|
+
end
|
15
|
+
|
16
|
+
def slug
|
17
|
+
raw['slug']
|
18
|
+
end
|
19
|
+
|
20
|
+
def id
|
21
|
+
return unless raw['id']
|
22
|
+
|
23
|
+
Integer raw['id']
|
24
|
+
end
|
25
|
+
|
26
|
+
def epoch
|
27
|
+
return unless raw['epoch']
|
28
|
+
|
29
|
+
Integer raw['epoch']
|
30
|
+
end
|
31
|
+
|
32
|
+
def date
|
33
|
+
return unless raw['date']
|
34
|
+
|
35
|
+
DateTime.parse raw['date']
|
36
|
+
end
|
37
|
+
|
38
|
+
def company
|
39
|
+
raw['company']
|
40
|
+
end
|
41
|
+
|
42
|
+
def company_logo
|
43
|
+
raw['company_logo']
|
44
|
+
end
|
45
|
+
|
46
|
+
def position
|
47
|
+
raw['position']
|
48
|
+
end
|
49
|
+
|
50
|
+
def tags
|
51
|
+
return unless raw['tags']
|
52
|
+
|
53
|
+
raw['tags'].map do |tag|
|
54
|
+
tag.gsub(' ', '_').to_sym
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def logo
|
59
|
+
raw['logo']
|
60
|
+
end
|
61
|
+
|
62
|
+
def description
|
63
|
+
raw['description']
|
64
|
+
end
|
65
|
+
|
66
|
+
def description_text
|
67
|
+
return unless raw['description']
|
68
|
+
|
69
|
+
raw['description'].gsub(HTML_CHARS_REGEX, ' ').strip.gsub(/\s+/, ' ')
|
70
|
+
end
|
71
|
+
|
72
|
+
def location
|
73
|
+
raw['location']
|
74
|
+
end
|
75
|
+
|
76
|
+
def original
|
77
|
+
raw['original']
|
78
|
+
end
|
79
|
+
|
80
|
+
def url
|
81
|
+
raw['url']
|
82
|
+
end
|
83
|
+
|
84
|
+
def apply_url
|
85
|
+
raw['apply_url']
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/remoteok.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/remoteok/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'remoteok'
|
7
|
+
spec.version = RemoteOK::VERSION
|
8
|
+
spec.authors = ['Edward Woodcock']
|
9
|
+
spec.email = ['768254+RemoteCTO@users.noreply.github.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby client for RemoteOK Jobs API'
|
12
|
+
spec.description = 'Fetch data from the API at remoteok.io'
|
13
|
+
spec.homepage = 'https://github.com/RemoteCTO/remote-ok-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
16
|
+
|
17
|
+
# spec.metadata['allowed_push_host'] = 'TODO: Set to 'http://mygemserver.com''
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/RemoteCTO/remote-ok-ruby'
|
21
|
+
# spec.metadata['changelog_uri'] = 'TODO: Put your gem's CHANGELOG.md URL here.'
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
# Prod dependencies
|
33
|
+
spec.add_dependency 'httparty', '~> 0.18.1'
|
34
|
+
|
35
|
+
# Dev dependencies
|
36
|
+
spec.add_development_dependency 'simplecov', '< 0.18'
|
37
|
+
|
38
|
+
# For more information and examples about making a new gem, checkout our
|
39
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remoteok
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Edward Woodcock
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simplecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.18'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.18'
|
41
|
+
description: Fetch data from the API at remoteok.io
|
42
|
+
email:
|
43
|
+
- 768254+RemoteCTO@users.noreply.github.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/workflows/main.yml"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".rspec_status"
|
52
|
+
- ".rubocop.yml"
|
53
|
+
- CHANGELOG.md
|
54
|
+
- CODE_OF_CONDUCT.md
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- LICENSE
|
58
|
+
- LICENSE.txt
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- bin/console
|
62
|
+
- bin/setup
|
63
|
+
- lib/remoteok.rb
|
64
|
+
- lib/remoteok/client.rb
|
65
|
+
- lib/remoteok/job.rb
|
66
|
+
- lib/remoteok/version.rb
|
67
|
+
- remoteok.gemspec
|
68
|
+
homepage: https://github.com/RemoteCTO/remote-ok-ruby
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata:
|
72
|
+
homepage_uri: https://github.com/RemoteCTO/remote-ok-ruby
|
73
|
+
source_code_uri: https://github.com/RemoteCTO/remote-ok-ruby
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.6.0
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubygems_version: 3.2.15
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: Ruby client for RemoteOK Jobs API
|
93
|
+
test_files: []
|