alma_api 1.0.2 → 2.0.0

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: be075de2651cd726b827c48274a0a71338e21064cb33433597c9e09cafabdf41
4
- data.tar.gz: 972119e4a07785159951b1a29f98636608d46c8ce2b8179465191ff3af3804d4
3
+ metadata.gz: '0285277d54273b7ad7bc88e92941b3b5dc8d687f185da09e178b4634374f9888'
4
+ data.tar.gz: 74705ba4e5216b96c4c2855a6122d888d26fcf13d5c59cc2d6816851971b573a
5
5
  SHA512:
6
- metadata.gz: cc56000113b9aebc0987713e9ebc74a2e52144989fe66dedf6f9b2f8aa128bef2af402e07211a07abcb6bd20f35d480f2fe7beaaed0a4b1626661772a9826834
7
- data.tar.gz: 42d7d770833351af4aea0f0bd26bf4920f46fc66ccbf081c079c2f1cb0707a660d27163cf2d3cbd0792e4570e7b7ab5e09163da78acf7f888a81f9608be821fe
6
+ metadata.gz: bdf8362e4e389cecb7c5d51627115b54d764696903b1745415a651bc375788c4b12b8c061dd476222e60b7f714a100d0a419ba755f017bc8bd2761bcac4ea9c2
7
+ data.tar.gz: afe0e7c68cfb16c0564dad09b7a67dd2896b023abf9a710e7dbd58d1e2815a7999a9b2e6f23846d1644f516537e2621161dc2abc32669919cdd5ce683cdb8955
data/README.md CHANGED
@@ -13,7 +13,7 @@ The main purpose of this library is to abstract authentication, error handling,
13
13
 
14
14
  It uses [`faraday`](https://github.com/lostisland/faraday) as the underlying http client, [`nokogiri`](https://github.com/sparklemotion/nokogiri) for XML parsing, and [`oj`](https://github.com/ohler55/oj) and [`hashie`](https://github.com/hashie/hashie) for JSON processing.
15
15
 
16
- __Note: This is NOT an official Alma API client. It is developed at the University Library of Paderborn as an open source project.__
16
+ __Note: This is _NOT_ an official Alma API client. It is developed at the [University Library of Paderborn](https://ub.uni-paderborn.de) as an open source project and used in production as part of the library's [discovery portal](https://katalog.ub.uni-paderborn.de).__
17
17
 
18
18
  ## Installation
19
19
 
@@ -28,38 +28,64 @@ and run the `bundle install` command in your terminal.
28
28
 
29
29
  > You need an API key for your Alma Instance in order to use this client. Please consult the [Ex Libris developer documentation on how to use the Alma REST APIs](https://developers.exlibrisgroup.com/alma/apis/#using) for more information how to get and setup your API keys.
30
30
 
31
+ __Note: There a some breaking changes when upgrading from 1.x to 2.x. [Please read the section on upgrading below](#upgrading).__
32
+
33
+ ### Quick example
34
+
35
+ Here is a minimal example to get started. Read the sections below for more information on how to use this library.
36
+
37
+ ```ruby
38
+ # Create a client
39
+ client = AlmaApi::Client.configure do |config|
40
+ config.api_key = "YOUR API KEY"
41
+ end
42
+
43
+ # Use the client to get some users
44
+ users = client.get("users", params: {limit: 2})
45
+ ```
46
+
31
47
  ### Creating a configuration
32
48
 
33
- To use this library you need an `AlmaApi::Client` instance. The client requires an `AlmaApi::Configuration`.
49
+ To use this library you need an `AlmaApi::Client` instance. To create a client you first need an `AlmaApi::Configuration`.
34
50
 
35
51
  ```ruby
36
- configuration = AlmaApi::Configuration.new(
37
- api_key: "...", # 1. required
38
- base_url: "...", # 2. optional
39
- default_format: "...", # 3. optional
40
- language: "..." # 4. optional
41
- )
52
+ # Normal method
53
+ configuration = AlmaApi::Configuration.new(api_key: "YOUR API KEY")
54
+ # ... or
55
+ configuration = AlmaApi::Configuration.new
56
+ configuration.api_key = "YOUR API KEY"
57
+
58
+ # Block-style
59
+ configuration = AlmaApi::Configuration.new do |config|
60
+ config.api_key = "YOUR API KEY"
61
+ end
42
62
  ```
63
+ The API key is the only required option to get a functional configuration. There are sensible default values for all other options.
64
+
65
+ The following options are available:
43
66
 
44
67
  1. `api_key`
45
- Add your Alma API key here.
68
+ Set your Alma API key. This is the only option that can be passed to the constructor as a shortcut. All other options must be set using setters.
46
69
  2. `base_url`
47
- Add the base URL to be used for each request. Ex Libris provides different API gateways for different geographical locations. See [the documentation here](https://developers.exlibrisgroup.com/alma/apis/#calling) for more information. This parameter is optional and defaults to the Alma API Gateway for Europe: `https://api-eu.hosted.exlibrisgroup.com/almaws/v1`.
70
+ Set the base URL to be used for each request. Ex Libris provides different API gateways for different geographical locations. See [the documentation here](https://developers.exlibrisgroup.com/alma/apis/#calling) for more information. This parameter is optional and defaults to the Alma API Gateway for Europe: `https://api-eu.hosted.exlibrisgroup.com/almaws/v1`.
48
71
 
49
- You can use a `Symbol` as a shortcut to set the `base_url` for one of the preconfigured gateways `:na` (North America), `:eu` (Europe), `:ap` (Asia-Pacific), `:ca` (Canada), `:cn` (China).
72
+ This expects a `String` with a valid URL. However, you can use a `Symbol` as a shortcut to set the `base_url` for one of the preconfigured gateways `:na` (North America), `:eu` (Europe), `:ap` (Asia-Pacific), `:ca` (Canada), `:cn` (China).
50
73
 
51
74
  For example, to set the `base_url` for the canadian gateway, use
52
75
 
53
76
  ```ruby
54
- configuration = AlmaApi::Configuration.new(
55
- base_url: :ca,
56
- ...
77
+ configuration = AlmaApi::Configuration.new do |config|
78
+ config.api_key = "YOUR API KEY"
79
+ config.base_url = :ca
57
80
  )
58
81
  ```
59
82
  3. `default_format`
60
- The default format to use for each request. The client supports `json` and `xml`. The default is `json`.
83
+ The default format to use for each request. The client supports `"json"` and `"xml"`. The default is `"json"`.
61
84
  4. `language`
62
- The language used by Alma for error messages and textual information. The default is English (`en`). To change this, set this parameter to any 2-letter language code that is supported and enabled in Alma (see the mapping table "Institution Languages" in Alma).
85
+ The language used by Alma for error messages and textual information. The default is English (`"en"`). To change this, set this parameter to any 2-letter language code that is supported and enabled in Alma (see the mapping table "Institution Languages" in Alma).
86
+ 5. `timeout`
87
+ The max number of seconds (Integer, Float) to wait for a request to complete. The default is `nil` which uses
88
+ the default of the underlying Faraday adapter (`Net::HTTP`).
63
89
 
64
90
  ### Creating a client
65
91
 
@@ -68,28 +94,31 @@ With the configuration ready, you can create the client.
68
94
  ```ruby
69
95
  client = AlmaApi::Client.new(configuration)
70
96
  ```
71
-
72
- As a shortcut, you can call `AlmaApi.configure` to get the client instance. Note that each call to `AlmaApi.configure` returns a new `AlmaApi::Client` instance.
97
+ As a shortcut, you can call `AlmaApi.configure` with a block to get the client instance. Note that each call to `AlmaApi.configure` returns a new `AlmaApi::Client` instance.
73
98
 
74
99
  ```ruby
75
- client = AlmaApi.configure do |config|
100
+ client = AlmaApi::Client.configure do |config|
76
101
  config.api_key = "..."
77
- config.base_url = "..."
78
- config.default_format = "..."
79
- config.language = "..."
102
+ ...
80
103
  end
81
104
  ```
82
105
  ### Using the client
83
106
 
107
+ #### Calling Alma
108
+
84
109
  The client provides the following methods: `#get`, `#post`, `#put` and `#delete` to call the Alma APIs with the corresponding HTTP methods `GET`, `POST`, `PUT` and `DELETE`.
85
110
 
86
111
  Each method expects a URL path to the resource relative to the configured `base_url` as it's first parameter. Parameters that the Alma API expects as part of the URL path must be included here.
87
112
 
88
- To set query string parameters, set the `params:` option and provide a Ruby `hash`. To override the `default_format` for an individual request, you can set the `format:` option to `json` or `xml`, depending on your needs. Setting the format to `xml` is preferable for Alma APIs that work with MARCXML data.
113
+ To set query string parameters, set the `params:` option and provide a Ruby `hash`. To override the `default_format` for an individual request, you can set the `format:` option to `"json"` or `"xml"`, depending on your needs. Setting the format to `"xml"` is preferable for Alma APIs that work with MARCXML data.
114
+
115
+ To set the body of a `#post` or `#put` request, you can set the `body:` option. If the request format is `"json"`, the `body:` option should contain a valid json string. Otherwise, if the request format is `"xml"`, the option should be a valid XML string.
116
+
117
+ In the case of a JSON request, the result of the call is a Ruby `hash`. For a XML request, the result is a `Nokogiri::XML::Document` instance, as this library uses [`nokogiri`](https://github.com/sparklemotion/nokogiri) under the hood for XML processing.
89
118
 
90
- To set the body of a `#post` or `#put` request, you can set the `body:` option. If the request format is `json`, the `body:` option should contain a valid json string. Otherwise, if the request format is `xml`, the option should be a valid XML string.
119
+ #### Get remaining API calls
91
120
 
92
- In the case of a `json` request, the result of the call is a Ruby `hash`. For `xml`, the result is a `Nokogiri::XML::Document` instance, as this library uses [`nokogiri`](https://github.com/sparklemotion/nokogiri) under the hood for XML processing.
121
+ Alma reports the number of remaining API calls as part of the response. You can call `#remaining_api_calls` on the client to get this number. In case of an error this simply returns `-1`.
93
122
 
94
123
  ## Examples
95
124
 
@@ -156,11 +185,22 @@ client.delete("users/#{user_id}") # user_id is a URL parameter
156
185
 
157
186
  ## Error handling
158
187
 
159
- There are three types of errors that can occur when calling the Alma APIs with this library. Each error exposes the `#message` and `#code` methods for further inspection. The message is returned in the language set in the configuration (default is English).
188
+ There are four types of errors that can occur when calling the Alma APIs with this library.
160
189
 
161
- For gateway errors, the code is a string token (e.g. REQUEST_TOO_LARGE). For logical errors, the code is usually a number (e.g. 401850). See the "Possible Error Codes" section for each resource in the [documentation](https://developers.exlibrisgroup.com/alma/apis/) for details.
190
+ ### 1. `AlmaApi::Error`
162
191
 
163
- ### 1. `AlmaApi::GatewayError`
192
+ This is the base error class for this library. All errors raised within this library during a request will result in an `AlmaApi::Error` or in one of the more specific sub classes listed below.
193
+
194
+ This error is also raised if something goes wrong when opening the connection, on SSL errors, network timeouts, etc.
195
+
196
+ The original error is wrapped and is available via the `#cause` method.
197
+
198
+ Each error exposes `#message` and `#code` methods for further inspection.
199
+ Messages that are generated by Alma are returned in the language set in the configuration (default is English).
200
+
201
+ The code is generated by Alma. For gateway errors, the code is a string token (e.g. REQUEST_TOO_LARGE). For logical errors, the code is usually a number (e.g. 401850). See the "Possible Error Codes" section for each resource in the [documentation](https://developers.exlibrisgroup.com/alma/apis/) for details.
202
+
203
+ ### 2. `AlmaApi::GatewayError`
164
204
 
165
205
  If the Alma API responds with a `4xx` OR `5xx` HTTP status AND one of the following error codes, an `AlmaApi::GatewayError` is thrown.
166
206
 
@@ -178,7 +218,7 @@ Any `4xx` HTTP status that does not result in an `AlmaApi::GatewayError` will be
178
218
 
179
219
  This is the most common error you will encounter and can be used to manage the control flow in your application.
180
220
 
181
- For example, if you're loading a user's details, you don't want your application to blow up if a user with the specified user ID doesn't exist. Instead, you can handle the error like this:
221
+ For example, if you're loading a user's details, you usually don't want your application to blow up if a user with the specified user ID doesn't exist. Instead, you can handle the error like this:
182
222
 
183
223
  ```ruby
184
224
  def load_user(user_id)
@@ -200,3 +240,26 @@ else
200
240
  end
201
241
 
202
242
  ```
243
+
244
+ ## Tweaking a request
245
+
246
+ As stated before this library uses [`faraday`](https://github.com/lostisland/faraday) as the underlying http client. It manages the Faraday connection, sets up the necessary headers and params and performs the requests against Alma.
247
+
248
+ Therefore there should be no need to tweak a request before sending it to Alma. This should be considered as a bug and we are happy to receive feature requests.
249
+
250
+ However, there is a way to tweak a request. For `#get`, `#post`, `#put` and `#delete` you can open a block that gives you access to the [`Faraday::Request`](https://www.rubydoc.info/github/lostisland/faraday/Faraday/Request) instance.
251
+
252
+ ```ruby
253
+ client.get("some/path") do |req|
254
+ req.headers["foo"] = "bar"
255
+ end
256
+ ```
257
+
258
+ ## Upgrading
259
+
260
+ ### From 1.x to 2.x
261
+
262
+ * `AlmaApi.configure` is deprecated. Use `AlmaApi::Client.configure` instead.
263
+ * All errors that get raised during a request result in an `AlmaApi::Error`. Use `#cause` to get the causing error.
264
+ * `AlmaApi::Client#remaining_api_calls` performs a request to read the value from Alma.
265
+ * `AlmaApi::Configuration` can be used to set a request timeout.
@@ -1,8 +1,14 @@
1
1
  module AlmaApi
2
2
  class Client
3
+ class << self
4
+ def configure
5
+ configuration = Configuration.new
6
+ yield(configuration) if block_given?
7
+ new(configuration)
8
+ end
9
+ end
3
10
 
4
- attr_reader :configuration,
5
- :remaining_api_calls
11
+ attr_reader :configuration
6
12
 
7
13
  def initialize(configuration)
8
14
  @configuration = configuration
@@ -11,7 +17,9 @@ module AlmaApi
11
17
 
12
18
  def get(url, params: {}, format: nil)
13
19
  perform_request do
14
- connection(format: format, params: params).get(url)
20
+ connection(format: format, params: params).get(url) do |req|
21
+ yield(req) if block_given?
22
+ end
15
23
  end
16
24
  end
17
25
 
@@ -19,6 +27,7 @@ module AlmaApi
19
27
  perform_request do
20
28
  connection(format: format, params: params).post(url) do |req|
21
29
  req.body = body
30
+ yield(req) if block_given?
22
31
  end
23
32
  end
24
33
  end
@@ -27,19 +36,32 @@ module AlmaApi
27
36
  perform_request do
28
37
  connection(format: format, params: params).put(url) do |req|
29
38
  req.body = body
39
+ yield(req) if block_given?
30
40
  end
31
41
  end
32
42
  end
33
43
 
34
44
  def delete(url, params: {}, format: nil)
35
45
  perform_request do
36
- connection(format: format, params: params).delete(url)
46
+ connection(format: format, params: params).delete(url) do |req|
47
+ yield(req) if block_given?
48
+ end
37
49
  end
38
50
  end
39
51
 
52
+ def remaining_api_calls
53
+ response = connection.get("users/operation/test")
54
+ rac = response.headers["x-exl-api-remaining"]
55
+ rac.present? ? rac.to_i : -1
56
+ rescue StandardError
57
+ -1
58
+ end
59
+
40
60
  private
41
61
 
42
62
  def connection(format: nil, params: {})
63
+ # The format parameter is used to specify the format of the request.
64
+ # Alma supports both JSON and XML, but the default is JSON.
43
65
  format = case AlmaApi.validate_format!(format)
44
66
  when "xml" then "application/xml"
45
67
  when "json" then "application/json"
@@ -47,20 +69,40 @@ module AlmaApi
47
69
  "application/json"
48
70
  end
49
71
 
72
+ # Setup default parameters. For now just the language.
73
+ # If the language is not specified, then the default language is English.
50
74
  default_params = {
51
75
  lang: configuration.language
52
76
  }.reject do |k, v|
53
77
  k == :lang && (v.blank? || v == "en")
54
78
  end
55
79
 
80
+ # Merge the default parameters with the parameters passed in.
81
+ params = default_params.reverse_merge(params)
82
+
83
+ # Setup the headers for the request.
84
+ headers = {
85
+ "Authorization" => "apikey #{configuration.api_key}",
86
+ "Accept" => format,
87
+ "Content-Type" => format
88
+ }
89
+
90
+ # If the params contains a password parameter, delete that from the params
91
+ # and add it to the headers. This is a special case for the Alma API when
92
+ # authenticating a user.
93
+ # @see https://developers.exlibrisgroup.com/alma/apis/docs/users/UE9TVCAvYWxtYXdzL3YxL3VzZXJzL3t1c2VyX2lkfQ==/
94
+ if (password = params.delete(:password) || params.delete("password")).present?
95
+ headers["Exl-User-Pw"] = password
96
+ end
97
+
98
+ # Finally create and return the Faraday connection object.
56
99
  Faraday.new(
57
100
  configuration.base_url,
58
- params: default_params.reverse_merge(params),
59
- headers: {
60
- "Authorization": "apikey #{configuration.api_key}",
61
- "Accept": format,
62
- "Content-Type": format
63
- }
101
+ request: {
102
+ timeout: configuration.timeout
103
+ },
104
+ params: params,
105
+ headers: headers
64
106
  ) do |faraday|
65
107
  faraday.response :raise_error # raise Faraday::Error on status code 4xx or 5xx
66
108
  end
@@ -68,31 +110,32 @@ module AlmaApi
68
110
 
69
111
  def perform_request
70
112
  response = yield
71
- set_remaining_api_calls(response)
72
113
  parse_response_body(response.body)
73
114
  rescue Faraday::Error => e
74
115
  handle_faraday_error(e)
116
+ rescue StandardError
117
+ raise Error, GENERAL_ERROR_MESSAGE
75
118
  end
76
119
 
77
120
  def handle_faraday_error(error)
78
- error_response = parse_error_response_body(error.response_body)
121
+ # The error response body is either XML, JSON or empty, so we need to parse it
122
+ error_message, error_code = parse_error_response_body(error.response_body)
79
123
 
80
- case error_response[:error_code]
81
- when *GATEWAY_ERROR_CODES
82
- raise GatewayError.new(error_response[:error_message], error_response[:error_code])
83
- else
124
+ if error_message.present? && error_code.present?
125
+ # Raise a gateway error if the error code is one of the gateway error codes
126
+ raise GatewayError.new(error_message, error_code) if GATEWAY_ERROR_CODES.include?(error_code)
127
+
128
+ # Check the response status code
84
129
  case error.response_status
85
130
  when 400..499
86
- raise LogicalError.new(error_response[:error_message], error_response[:error_code])
87
- else
88
- raise ServerError.new(error_response[:error_message], error_response[:error_code])
131
+ raise LogicalError.new(error_message, error_code)
132
+ when 500..599
133
+ raise ServerError.new(error_message, error_code)
89
134
  end
90
135
  end
91
- end
92
136
 
93
- def set_remaining_api_calls(response)
94
- rac = response.headers[:x_alma_api_remaining]
95
- @remaining_api_calls = rac.to_i if rac.present?
137
+ # If we get here, then we don't know what the error is, so we raise a generic error.
138
+ raise Error, GENERAL_ERROR_MESSAGE
96
139
  end
97
140
 
98
141
  def parse_response_body(body)
@@ -108,12 +151,13 @@ module AlmaApi
108
151
  end
109
152
 
110
153
  def parse_error_response_body(body)
154
+ error_message = nil
155
+ error_code = nil
156
+
111
157
  if is_xml_response?(body)
112
158
  xml = Nokogiri::XML.parse(body)
113
- error_message = xml.at("errorMessage")&.text
114
- error_code = xml.at("errorCode")&.text
115
-
116
- {error_message: error_message, error_code: error_code}
159
+ error_message = xml.at("errorMessage")&.text&.presence
160
+ error_code = xml.at("errorCode")&.text&.presence&.upcase
117
161
  elsif is_json_response?(body)
118
162
  json = Oj.load(body)
119
163
  json.extend Hashie::Extensions::DeepFind
@@ -123,13 +167,11 @@ module AlmaApi
123
167
  # and sometimes the format is:
124
168
  # {"web_service_result":{"errorList":{"error":{"errorMessage":"xxx","errorCode":"xxx"}}}}
125
169
  # so we use a deep find to find the first occurrence of "errorMessage" and "errorCode"
126
- error_message = json.deep_find("errorMessage")
127
- error_code = json.deep_find("errorCode")
128
-
129
- {error_message: error_message, error_code: error_code}
130
- else
131
- {error_message: nil, error_code: nil}
170
+ error_message = json.deep_find("errorMessage")&.presence
171
+ error_code = json.deep_find("errorCode")&.presence
132
172
  end
173
+
174
+ [error_message, error_code]
133
175
  end
134
176
 
135
177
  def is_xml_response?(body)
@@ -9,19 +9,26 @@ module AlmaApi
9
9
  cn: "https://api-cn.hosted.exlibrisgroup.cn/almaws/v1" # China
10
10
  }.freeze
11
11
 
12
+ DEFAULT_GATEWAY = GATEWAYS[:eu].freeze
12
13
  DEFAULT_FORMAT = "json".freeze
13
14
  DEFAULT_LANGUAGE = "en".freeze
14
15
 
15
16
  attr_reader :api_key,
16
17
  :base_url,
17
18
  :default_format,
18
- :language
19
+ :language,
20
+ :timeout
19
21
 
20
- def initialize(api_key: nil, base_url: nil, default_format: nil, language: nil)
22
+ def initialize(api_key: nil)
23
+ # Set defaults. Passing nil to the setters will set the default value.
21
24
  self.api_key = api_key
22
- self.base_url = base_url
23
- self.default_format = default_format
24
- self.language = language
25
+ self.base_url = nil
26
+ self.default_format = nil
27
+ self.language = nil
28
+ self.timeout = nil
29
+
30
+ # Yield self to allow block-style configuration.
31
+ yield(self) if block_given?
25
32
  end
26
33
 
27
34
  def api_key=(value)
@@ -30,11 +37,13 @@ module AlmaApi
30
37
 
31
38
  def base_url=(value)
32
39
  if value.is_a?(Symbol)
33
- raise ArgumentError, "Invalid gateway: #{value}" unless GATEWAYS.keys.include?(value.to_sym)
40
+ raise ArgumentError, "Invalid gateway: #{value}" unless GATEWAYS.keys.include?(value)
34
41
 
35
42
  @base_url = GATEWAYS[value]
43
+ elsif value.is_a?(String)
44
+ @base_url = value.presence || DEFAULT_GATEWAY
36
45
  else
37
- @base_url = value.presence || GATEWAYS[:eu]
46
+ @base_url = DEFAULT_GATEWAY
38
47
  end
39
48
  end
40
49
 
@@ -43,7 +52,11 @@ module AlmaApi
43
52
  end
44
53
 
45
54
  def language=(value)
46
- @language = value.presence || DEFAULT_LANGUAGE
55
+ @language = value.presence&.to_s || DEFAULT_LANGUAGE
56
+ end
57
+
58
+ def timeout=(value)
59
+ @timeout = value.presence
47
60
  end
48
61
 
49
62
  end
@@ -1,3 +1,3 @@
1
1
  module AlmaApi
2
- VERSION = "1.0.2".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  end
data/lib/alma_api.rb CHANGED
@@ -15,7 +15,7 @@ module AlmaApi
15
15
  class Error < StandardError
16
16
  attr_reader :code
17
17
 
18
- def initialize(message, code)
18
+ def initialize(message=nil, code=nil)
19
19
  @code = code.presence || DEFAULT_ERROR_CODE
20
20
  super(message.presence || DEFAULT_ERROR_MESSAGE)
21
21
  end
@@ -25,6 +25,8 @@ module AlmaApi
25
25
  class ServerError < Error; end
26
26
  class LogicalError < Error; end
27
27
 
28
+ GENERAL_ERROR_MESSAGE = "Error occured while performing request. Check #cause for more details.".freeze
29
+
28
30
  GATEWAY_ERROR_CODES = [
29
31
  "GENERAL_ERROR",
30
32
  "UNAUTHORIZED",
@@ -39,9 +41,10 @@ module AlmaApi
39
41
  class << self
40
42
 
41
43
  def configure
42
- configuration = Configuration.new
43
- yield(configuration) if block_given?
44
- Client.new(configuration)
44
+ warn "[DEPRECATION] `AlmaApi.configure` is deprecated. Please use `AlmaApi::Client.configure` instead."
45
+ client = Client.configure
46
+ yield(client.configuration) if block_given?
47
+ client
45
48
  end
46
49
 
47
50
  def validate_format!(format)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alma_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Sprotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-15 00:00:00.000000000 Z
11
+ date: 2024-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.4.10
121
+ rubygems_version: 3.4.19
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: A Ruby client library for the Ex Libris Alma REST APIs