Class: AlmaApi::Client
- Inherits:
-
Object
- Object
- AlmaApi::Client
- Defined in:
- lib/alma_api/client.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#remaining_api_calls ⇒ Object
readonly
Returns the value of attribute remaining_api_calls.
Instance Method Summary collapse
- #delete(url, params: {}, format: nil) ⇒ Object
- #get(url, params: {}, format: nil) ⇒ Object
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
- #post(url, params: {}, body: nil, format: nil) ⇒ Object
- #put(url, params: {}, body: nil, format: nil) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/alma_api/client.rb', line 7 def initialize(configuration) @configuration = configuration @remaining_api_calls = -1 end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/alma_api/client.rb', line 4 def configuration @configuration end |
#remaining_api_calls ⇒ Object (readonly)
Returns the value of attribute remaining_api_calls.
4 5 6 |
# File 'lib/alma_api/client.rb', line 4 def remaining_api_calls @remaining_api_calls end |
Instance Method Details
#delete(url, params: {}, format: nil) ⇒ Object
34 35 36 37 38 |
# File 'lib/alma_api/client.rb', line 34 def delete(url, params: {}, format: nil) perform_request do connection(format: format, params: params).delete(url) end end |
#get(url, params: {}, format: nil) ⇒ Object
12 13 14 15 16 |
# File 'lib/alma_api/client.rb', line 12 def get(url, params: {}, format: nil) perform_request do connection(format: format, params: params).get(url) end end |
#post(url, params: {}, body: nil, format: nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/alma_api/client.rb', line 18 def post(url, params: {}, body: nil, format: nil) perform_request do connection(format: format, params: params).post(url) do |req| req.body = body end end end |
#put(url, params: {}, body: nil, format: nil) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/alma_api/client.rb', line 26 def put(url, params: {}, body: nil, format: nil) perform_request do connection(format: format, params: params).put(url) do |req| req.body = body end end end |