esi-sdk 2.1.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8602a9c524badb41010f8762e394df4bc923307acece2d53b64e91cdc7f934ae
4
- data.tar.gz: 268036494ca33085700e903a266e4ca69f280637f6e53b46ebd33476b4c3db5a
3
+ metadata.gz: a7c874338d7aa0d467285e375390a6b185c184d9e5882a7f2ca519411b76e6df
4
+ data.tar.gz: 80b17cc143a6e5479005498a6351adccec57a997ac405138677beeb6dc10789e
5
5
  SHA512:
6
- metadata.gz: 7f0c8d1c2052b7670cefa35bc0b98250bdac06e5cb1fa1c04be6c752f42beb2b859660ec9dd3450c10f018ff8015e0e896ff9fefb058996b6161bdee59b03fc2
7
- data.tar.gz: 135710a1b828b631fcc0169e4c590c4a0ed968c818a0d93aaf397a399e14ad1d85b1a468c18922d9937eb5ea237df5aecd07b5311ca2e38336efd991015f9d8b
6
+ metadata.gz: f50b8969549d4f8a8cb866725f46e058cd761072da6024a781469d95123e5a84bdcd981f77d4fe636b575ec333c08cfe6db95c78b5374c44df8a58a1db96bd9f
7
+ data.tar.gz: d8ca8eeba8e76b7c7915edd7703ca4a57046ccb54fa520384239331dc7a26ee2dd8c0604659acad2b184348589a9650d7e2be5e35eb8ff6227532bac7d25ea09
@@ -1,4 +1,4 @@
1
- name: Ruby
1
+ name: Build
2
2
 
3
3
  on:
4
4
  pull_request:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ESI SDK Changelog
2
2
 
3
+ ## [2.1.2](https://github.com/bokoboshahni/esi-sdk-ruby/compare/v2.1.1...v2.1.2) (2021-10-09)
4
+
3
5
  ## [2.1.1](https://github.com/bokoboshahni/esi-sdk-ruby/compare/v2.1.0...v2.1.1) (2021-10-09)
4
6
 
5
7
  # [2.1.0](https://github.com/bokoboshahni/esi-sdk-ruby/compare/v2.0.0...v2.1.0) (2021-10-09)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- esi-sdk (2.1.1)
4
+ esi-sdk (2.1.2)
5
5
  httpx (~> 0.18)
6
6
  retriable (~> 3.1)
7
7
 
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- ![Build images](https://github.com/bokoboshahni/esi-sdk-ruby/workflows/CICD/badge.svg)
1
+ [![Build](https://github.com/bokoboshahni/esi-sdk-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/bokoboshahni/esi-sdk-ruby/actions/workflows/build.yml)
2
+ [![Gem Version](https://badge.fury.io/rb/esi-sdk.svg)](https://badge.fury.io/rb/esi-sdk)
2
3
 
3
4
  # EVE Swagger Interface (ESI) SDK
4
5
 
data/lib/esi/client.rb CHANGED
@@ -123,53 +123,58 @@ module ESI
123
123
  session.authentication token
124
124
  end
125
125
 
126
+ # Make a `DELETE` request to the ESI endpoint.
127
+ #
128
+ # @param path [String] The request path, excluding version like `latest`.
129
+ # @param params [Hash] Query string parameters to pass to the request.
130
+ # @param headers [Hash] Headers to pass to the request.
126
131
  def delete(path, params: {}, headers: {})
127
- params.delete_if { |_, v| v.nil? }
128
- response = session.delete("/#{version}#{path}", params: params, headers: headers)
129
- response.raise_for_status
130
- response
131
- rescue HTTPX::Error
132
- raise_error(response)
132
+ make_request(:delete, path, params: params, headers: headers)
133
133
  end
134
134
 
135
+ # Make a `GET` request to the ESI endpoint.
136
+ #
137
+ # @param path [String] The request path, excluding version like `latest`.
138
+ # @param params [Hash] Query string parameters to pass to the request.
139
+ # @param headers [Hash] Headers to pass to the request.
135
140
  def get(path, params: {}, headers: {})
136
- params.delete_if { |_, v| v.nil? }
137
- response = session.get("/#{version}#{path}", params: params, headers: headers)
138
- response.raise_for_status
139
-
140
- return paginate(response, "/#{version}#{path}", params, headers) if paginated?(response)
141
-
142
- response
143
- rescue HTTPX::Error
144
- raise_error(response)
141
+ make_request(:get, path, params: params, headers: headers)
145
142
  end
146
143
 
144
+ # Make a `POST` request to the ESI endpoint.
145
+ #
146
+ # @param path [String] The request path, excluding version like `latest`.
147
+ # @param params [Hash] Query string parameters to pass to the request.
148
+ # @param headers [Hash] Headers to pass to the request.
149
+ # @param payload [Hash] Payload to encode as JSON to pass to the request.
147
150
  def post(path, payload: {}, params: {}, headers: {})
148
- params.delete_if { |_, v| v.nil? }
149
- response = session.post("/#{version}#{path}",
150
- params: params,
151
- headers: headers,
152
- json: payload)
153
- response.raise_for_status
154
- response
155
- rescue HTTPX::Error
156
- raise_error(response)
151
+ make_request(:post, path, params: params, headers: headers, payload: payload)
157
152
  end
158
153
 
154
+ # Make a `PUT` request to the ESI endpoint.
155
+ #
156
+ # @param path [String] The request path, excluding version like `latest`.
157
+ # @param params [Hash] Query string parameters to pass to the request.
158
+ # @param headers [Hash] Headers to pass to the request.
159
+ # @param payload [Hash] Payload to encode as JSON to pass to the request.
159
160
  def put(path, payload: {}, params: {}, headers: {})
160
- params.delete_if { |_, v| v.nil? }
161
- response = session.put("/#{version}#{path}",
162
- params: params,
163
- headers: headers,
164
- json: payload)
161
+ make_request(:put, path, params: params, headers: headers, payload: payload)
162
+ end
163
+
164
+ private
165
+
166
+ def make_request(method, path, params: {}, headers: {}, payload: nil)
167
+ versioned_path = "/#{version}#{path}"
168
+ response = session.request(method, versioned_path, params: params, headers: headers, json: payload)
165
169
  response.raise_for_status
170
+
171
+ return paginate(response, versioned_path, params, headers) if paginated?(response)
172
+
166
173
  response
167
174
  rescue HTTPX::Error
168
175
  raise_error(response)
169
176
  end
170
177
 
171
- private
172
-
173
178
  def paginate(response, path, params, headers) # rubocop:disable Metrics/MethodLength
174
179
  response_headers = normalize_headers(response.headers)
175
180
  page_count = response_headers["x-pages"].to_i
data/lib/esi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ESI
4
- VERSION = "2.1.1"
4
+ VERSION = "2.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esi-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bokobo Shahni
@@ -53,7 +53,7 @@ files:
53
53
  - ".github/ISSUE_TEMPLATE/support.md"
54
54
  - ".github/PULL_REQUEST_TEMPLATE.md"
55
55
  - ".github/dependabot.yml"
56
- - ".github/workflows/cicd.yml"
56
+ - ".github/workflows/build.yml"
57
57
  - ".gitignore"
58
58
  - ".rspec"
59
59
  - ".rubocop.yml"