rail-locator-api 0.0.29 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07baee00a6ed7c4637787309ec679169f69181c4098d413e23777b83bd6ccb53
4
- data.tar.gz: e720a63b182f92f2ea0f55a02ab7fb616756c392d81661fe8370d02b1784df7e
3
+ metadata.gz: 5ede41528479ea31925099520174f0ed0a80a2606b8765f8b807accb044fd962
4
+ data.tar.gz: ebc0acc5dbee2508dff3a999e0c8207c7597d2d32dd40a59ed6ff799504b1e69
5
5
  SHA512:
6
- metadata.gz: 16a93620fdeb1886830af3afba0ad02fadac2b6a78ff5bcdc4d2419f47b7d7e25d160a0ddd02eb84782c72ff21dd4fdb702383bc8f9374ece1ca0d57703836ca
7
- data.tar.gz: e83a8be5065e742dd2f5fe3a920552ed17fa9be80acd88b461b8fbcb13ffbe14507f54d253c97ccbaacbc9241645ba1457f17fa6acbe9f2a88e6a0626ace648f
6
+ metadata.gz: c81a85c81904a43f9c65a89939c961ab0c89aa3b63e577be00bddcdcff611421b84d4f2cd547503f543eca3df65fd5dcc1e1942be0731d0dd210a069f00bc2ba
7
+ data.tar.gz: 14759e3c5a4eb9a77582156b111ec7979751c564ff375f176ce6aaea8ad09657ead00a520215966bcb468feaeb38bd8f3abc550d8c74a73ee8987490174508f9
@@ -128,6 +128,10 @@ module RailLocatorApi
128
128
  request.headers['Authorization'] = "Bearer #{RailLocatorApi::Request.access_token}"
129
129
  end
130
130
  request.headers['User-Agent'] = "RailLocatorApi/#{RailLocatorApi::VERSION} Ruby gem"
131
+ if @request_builder.without_ratelimit
132
+ request.headers['X-Request-Without-Ratelimit'] = "1"
133
+ end
134
+
131
135
  request.headers.merge!(headers) if headers
132
136
  request.body = MultiJson.dump(body) if body
133
137
  request.options.timeout = self.timeout
@@ -1,7 +1,8 @@
1
1
  module RailLocatorApi
2
2
  class Request
3
3
  attr_accessor :access_token, :refresh_token, :api_key, :api_user_email, :api_user_password, :api_auth_method, :api_endpoint,
4
- :timeout, :open_timeout, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys, :debug, :logger, :test
4
+ :timeout, :open_timeout, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys, :debug,
5
+ :without_ratelimit, :logger, :test
5
6
 
6
7
  AUTH_METHODS = [:keycloak, :api_key, :base64]
7
8
  DEFAULT_AUTH_METHOD = :keycloak
@@ -10,12 +11,12 @@ module RailLocatorApi
10
11
 
11
12
  def initialize(access_token: nil, refresh_token: nil, api_key: nil, api_user_email: nil, api_user_password: nil,
12
13
  api_endpoint: nil, api_auth_method: nil, timeout: nil, open_timeout: nil, proxy: nil, ssl_options: nil,
13
- faraday_adapter: nil, symbolize_keys: false, debug: false, logger: nil, test: false)
14
+ faraday_adapter: nil, symbolize_keys: false, debug: false, without_ratelimit: false,
15
+ logger: nil, test: false)
14
16
 
15
17
  @path_parts = []
16
18
  @api_key = api_key || self.class.api_key || ENV['RAIL_LOCATOR_API_KEY']
17
19
  @api_key = @api_key.strip if @api_key
18
- @api_key = RailLocatorApi::api_key if @api_key.nil?
19
20
 
20
21
  @access_token = access_token || self.class.access_token || RailLocatorApi.generate_access_token.try(:dig, "access_token")
21
22
  @access_token = @access_token.strip if @access_token
@@ -35,6 +36,7 @@ module RailLocatorApi
35
36
  @faraday_adapter = faraday_adapter || self.class.faraday_adapter || Faraday.default_adapter
36
37
  @symbolize_keys = symbolize_keys || self.class.symbolize_keys || false
37
38
  @debug = debug || self.class.debug || false
39
+ @without_ratelimit = without_ratelimit || self.class.without_ratelimit
38
40
  @test = test || self.class.test || false
39
41
  @logger = logger || self.class.logger || ::Logger.new(STDOUT)
40
42
  end
@@ -93,15 +95,17 @@ module RailLocatorApi
93
95
  end
94
96
 
95
97
  class << self
96
- attr_accessor :access_token, :refresh_token, :api_key, :api_user_email, :api_user_password, :api_auth_method, :timeout, :open_timeout,
97
- :api_endpoint, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys, :debug, :logger, :test
98
+ attr_accessor :access_token, :refresh_token, :api_key, :api_user_email, :api_user_password, :api_auth_method,
99
+ :timeout, :open_timeout, :api_endpoint, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys,
100
+ :debug, :without_ratelimit, :logger, :test
98
101
 
99
102
  def method_missing(sym, *args, &block)
100
103
  new(access_token: self.access_token, refresh_token: self.refresh_token, api_key: self.api_key,
101
104
  api_user_email: self.api_user_email, api_user_password: self.api_user_email,
102
105
  api_auth_method: self.api_auth_method, api_endpoint: self.api_endpoint,
103
106
  timeout: self.timeout, open_timeout: self.open_timeout, faraday_adapter: self.faraday_adapter,
104
- symbolize_keys: self.symbolize_keys, debug: self.debug, proxy: self.proxy, ssl_options: self.ssl_options, logger: self.logger,
107
+ symbolize_keys: self.symbolize_keys, debug: self.debug, without_ratelimit: self.without_ratelimit,
108
+ proxy: self.proxy, ssl_options: self.ssl_options, logger: self.logger,
105
109
  test: self.test).send(sym, *args, &block)
106
110
  end
107
111
 
@@ -1,3 +1,3 @@
1
1
  module RailLocatorApi
2
- VERSION = "0.0.29"
2
+ VERSION = "0.0.33"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rail-locator-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov