ja 0.2.1 → 0.2.2
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 +4 -4
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -2
- data/README.md +4 -0
- data/ja.gemspec +15 -10
- data/lib/ja.rb +3 -3
- data/lib/ja/api.rb +6 -2
- data/lib/ja/version.rb +1 -1
- metadata +14 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12fe7effde6b2ce550f489abfb784aff870815d1bd08625cf1a5bc78b005b89e
|
4
|
+
data.tar.gz: 5dd922959665417ac190b99ee4c13f001b191c465e5a464cc7118e21269abd08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fff098268df88e8c0b76332cf83e2090951b184fee0c9be8e54ef3e246079d563de170d9683974e1a13b8be64ca53d177dc9bab82db9e0d618c96f40546ba7e2
|
7
|
+
data.tar.gz: 4daf8c5d9001d15cc37a1b6301f7c244340fff3a75d2e4bd4b81334c4ff88de54200d8ddd7c95e4e42e85dc5891aef53a27fdd56d16e43d5cc9bcf67f4d0d4e7
|
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 TODO: Write your email address. 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 [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in ja.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 12.0"
|
9
|
+
gem "rspec", "~> 3.0"
|
data/README.md
CHANGED
@@ -140,3 +140,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/iain/j
|
|
140
140
|
## License
|
141
141
|
|
142
142
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
143
|
+
|
144
|
+
## Code of Conduct
|
145
|
+
|
146
|
+
Everyone interacting in the Ja project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/iain/ja/blob/master/CODE_OF_CONDUCT.md).
|
data/ja.gemspec
CHANGED
@@ -1,31 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/ja/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
+
|
6
7
|
spec.name = "ja"
|
7
8
|
spec.version = Ja::VERSION
|
8
9
|
spec.authors = ["iain"]
|
9
10
|
spec.email = ["iain@iain.nl"]
|
11
|
+
|
10
12
|
spec.summary = "Opinionated helpers for making JSON calls with the http.rb gem"
|
11
13
|
spec.description = "Opinionated helpers for making JSON calls with the http.rb gem"
|
12
14
|
spec.homepage = "https://github.com/iain/ja"
|
13
15
|
spec.license = "MIT"
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/iain/ja/blob/master/CHANGELOG.md"
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
25
|
end
|
17
26
|
spec.bindir = "exe"
|
18
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
28
|
spec.require_paths = ["lib"]
|
20
29
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 2"
|
22
|
-
spec.add_development_dependency "rake", "~> 12"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3"
|
24
|
-
|
25
30
|
spec.add_development_dependency "pry"
|
26
31
|
spec.add_development_dependency "semantic_logger"
|
27
32
|
spec.add_development_dependency "nokogiri"
|
28
33
|
spec.add_development_dependency "webmock"
|
29
34
|
|
30
|
-
spec.add_dependency "http", ">=
|
35
|
+
spec.add_dependency "http", ">= 4.0.0"
|
31
36
|
end
|
data/lib/ja.rb
CHANGED
@@ -13,7 +13,7 @@ require "ja/debug_logger"
|
|
13
13
|
module Ja
|
14
14
|
|
15
15
|
def self.logger
|
16
|
-
@logger ||= default_logger
|
16
|
+
@logger ||= default_logger # rubocop:disable Naming/MemoizedInstanceVariableName
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.logger=(logger)
|
@@ -28,8 +28,8 @@ module Ja
|
|
28
28
|
!!@enable_semantic_logging
|
29
29
|
end
|
30
30
|
|
31
|
-
def self.api(
|
32
|
-
API.new(
|
31
|
+
def self.api(**kwargs, &block)
|
32
|
+
API.new(**kwargs, &block)
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.default_logger
|
data/lib/ja/api.rb
CHANGED
@@ -32,7 +32,7 @@ module Ja
|
|
32
32
|
|
33
33
|
def request(verb, uri, options = {})
|
34
34
|
full_uri = full_url(uri)
|
35
|
-
start_time =
|
35
|
+
start_time = now
|
36
36
|
client_with_request_id = client.headers("X-Request-Id" => Thread.current[:request_id])
|
37
37
|
response = client_with_request_id.request(verb, full_uri, options)
|
38
38
|
log_response(response, start_time, verb, full_uri, options)
|
@@ -59,7 +59,7 @@ module Ja
|
|
59
59
|
private
|
60
60
|
|
61
61
|
def log_response(response, start_time, verb, uri, _options)
|
62
|
-
duration = (
|
62
|
+
duration = ((now - start_time) * 1000.0).round(3)
|
63
63
|
|
64
64
|
log_level = case response.status
|
65
65
|
when 100..299
|
@@ -86,5 +86,9 @@ module Ja
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
def now
|
90
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
91
|
+
end
|
92
|
+
|
89
93
|
end
|
90
94
|
end
|
data/lib/ja/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iain
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '12'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '12'
|
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'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3'
|
55
13
|
- !ruby/object:Gem::Dependency
|
56
14
|
name: pry
|
57
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +72,14 @@ dependencies:
|
|
114
72
|
requirements:
|
115
73
|
- - ">="
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
75
|
+
version: 4.0.0
|
118
76
|
type: :runtime
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
80
|
- - ">="
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
82
|
+
version: 4.0.0
|
125
83
|
description: Opinionated helpers for making JSON calls with the http.rb gem
|
126
84
|
email:
|
127
85
|
- iain@iain.nl
|
@@ -132,6 +90,7 @@ files:
|
|
132
90
|
- ".gitignore"
|
133
91
|
- ".rspec"
|
134
92
|
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
135
94
|
- Gemfile
|
136
95
|
- LICENSE.txt
|
137
96
|
- README.md
|
@@ -148,8 +107,11 @@ files:
|
|
148
107
|
homepage: https://github.com/iain/ja
|
149
108
|
licenses:
|
150
109
|
- MIT
|
151
|
-
metadata:
|
152
|
-
|
110
|
+
metadata:
|
111
|
+
homepage_uri: https://github.com/iain/ja
|
112
|
+
source_code_uri: https://github.com/iain/ja
|
113
|
+
changelog_uri: https://github.com/iain/ja/blob/master/CHANGELOG.md
|
114
|
+
post_install_message:
|
153
115
|
rdoc_options: []
|
154
116
|
require_paths:
|
155
117
|
- lib
|
@@ -157,15 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
119
|
requirements:
|
158
120
|
- - ">="
|
159
121
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
122
|
+
version: 2.3.0
|
161
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
124
|
requirements:
|
163
125
|
- - ">="
|
164
126
|
- !ruby/object:Gem::Version
|
165
127
|
version: '0'
|
166
128
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
129
|
+
rubygems_version: 3.1.2
|
130
|
+
signing_key:
|
169
131
|
specification_version: 4
|
170
132
|
summary: Opinionated helpers for making JSON calls with the http.rb gem
|
171
133
|
test_files: []
|