rail-locator-api 0.1.19 → 0.1.22

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: 20b440c61404c3936e6e761d66ebb53d8a2a64b05f3b0e73218541cfea98b304
4
- data.tar.gz: 8d7cae49d86c17b95ab991a5e1656d03abf447b61f08462e222f5acfa9ce371a
3
+ metadata.gz: 26c888695c95854ab878b21e11f61be31c289e73c5d74708dc731dd258a3f0e4
4
+ data.tar.gz: 4ba18e21877cedb2d2fc690d63381caee050a15a13129add7c2d8fd6f2faddd9
5
5
  SHA512:
6
- metadata.gz: f8ab04fcd867b26435610fdd0207d8518e82fe76e5dda2d02f084650e87b5f270da20d3258830230e9ad54759a022f6b8e23d3b7116f66d6b26ced7430038755
7
- data.tar.gz: 3645f19709a8e38cc7c6a10214e8058a136bd71551363988e8e042c55763a7c233df8309cdad65eee262df71cbab410c5e65ace241978a637c5f3cb408589aa8
6
+ metadata.gz: 4ec8a39a99fc81ba75fe3e301f656af57127e1764a65a5b8cadf4f7f04f924b2c69c4567072147bbcdcd10c072f3f02143a0f91485ba028622aed0039942f781
7
+ data.tar.gz: 6deb44f8328b466ce4c20dae3edbe8307a5ab0897b2b90e66c98162bfa47b7256cd8e409a1394a0334fe8377db27ab5afe6e71ac0fa29e82566ee2a8e94fe1ac
@@ -152,6 +152,9 @@ module RailLocatorApi
152
152
  if @request_builder.without_ratelimit
153
153
  request.headers['X-Request-Without-Ratelimit'] = "1"
154
154
  end
155
+ if @request_builder.is_allow_access_to_coordinates
156
+ request.headers['X_IS_ALLOW_ACCESS_TO_COORDINATES'] = "1"
157
+ end
155
158
  request.headers.merge!(headers) if headers
156
159
  request.body = MultiJson.dump(body) if body
157
160
  request.options.timeout = self.timeout
@@ -2,7 +2,7 @@ module RailLocatorApi
2
2
  class Request
3
3
  attr_accessor :access_token, :refresh_token, :api_user_id, :api_key, :api_user_email, :api_user_password, :api_auth_method, :api_endpoint,
4
4
  :timeout, :open_timeout, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys, :debug,
5
- :without_ratelimit, :logger, :test
5
+ :without_ratelimit, :is_allow_access_to_coordinates, :logger, :test
6
6
 
7
7
  AUTH_METHODS = [:keycloak, :api_key, :base64]
8
8
  DEFAULT_AUTH_METHOD = :api_key
@@ -11,7 +11,7 @@ module RailLocatorApi
11
11
 
12
12
  def initialize(access_token: nil, refresh_token: nil, api_user_id: nil, api_key: nil, api_user_email: nil, api_user_password: nil,
13
13
  api_endpoint: nil, api_auth_method: nil, timeout: nil, open_timeout: nil, proxy: nil, ssl_options: nil,
14
- faraday_adapter: nil, symbolize_keys: false, debug: false, without_ratelimit: false,
14
+ faraday_adapter: nil, symbolize_keys: false, debug: false, without_ratelimit: false, is_allow_access_to_coordinates: false,
15
15
  logger: nil, test: false)
16
16
 
17
17
  @path_parts = []
@@ -38,6 +38,7 @@ module RailLocatorApi
38
38
  @symbolize_keys = symbolize_keys || self.class.symbolize_keys || false
39
39
  @debug = debug || self.class.debug || false
40
40
  @without_ratelimit = without_ratelimit || self.class.without_ratelimit
41
+ @is_allow_access_to_coordinates = is_allow_access_to_coordinates || self.class.is_allow_access_to_coordinates
41
42
  @test = test || self.class.test || false
42
43
  @logger = logger || self.class.logger || ::Logger.new(STDOUT)
43
44
  end
@@ -110,7 +111,7 @@ module RailLocatorApi
110
111
  class << self
111
112
  attr_accessor :access_token, :refresh_token, :api_user_id, :api_key, :api_user_email, :api_user_password, :api_auth_method,
112
113
  :timeout, :open_timeout, :api_endpoint, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys,
113
- :debug, :without_ratelimit, :logger, :test
114
+ :debug, :without_ratelimit, :is_allow_access_to_coordinates, :logger, :test
114
115
 
115
116
  def method_missing(sym, *args, &block)
116
117
  new(access_token: self.access_token, refresh_token: self.refresh_token,
@@ -120,6 +121,7 @@ module RailLocatorApi
120
121
  api_auth_method: self.api_auth_method, api_endpoint: self.api_endpoint,
121
122
  timeout: self.timeout, open_timeout: self.open_timeout, faraday_adapter: self.faraday_adapter,
122
123
  symbolize_keys: self.symbolize_keys, debug: self.debug, without_ratelimit: self.without_ratelimit,
124
+ is_allow_access_to_coordinates: self.is_allow_access_to_coordinates,
123
125
  proxy: self.proxy, ssl_options: self.ssl_options, logger: self.logger,
124
126
  test: self.test).send(sym, *args, &block)
125
127
  end
@@ -1,3 +1,3 @@
1
1
  module RailLocatorApi
2
- VERSION = "0.1.19"
2
+ VERSION = "0.1.22"
3
3
  end
@@ -9,11 +9,11 @@ require 'rail-locator-api/response'
9
9
 
10
10
  module RailLocatorApi
11
11
  class << self
12
- def generate_access_token
12
+ def generate_access_token(code=nil)
13
13
  if RailLocatorApi.keycloak_grant_type == "password"
14
14
  payload = "grant_type=#{RailLocatorApi.keycloak_grant_type}&client_id=#{RailLocatorApi.keycloak_client_id}&username=#{RailLocatorApi.api_user_email}&password=#{RailLocatorApi.api_user_password}"
15
15
  else
16
- payload = "grant_type=#{RailLocatorApi.keycloak_grant_type}&client_id=#{RailLocatorApi.keycloak_client_id}&client_secret=#{RailLocatorApi.keycloak_client_secret}&code=#{RailLocatorApi::Request.access_token}&redirect_uri=#{RailLocatorApi.keycloak_redirect_uri}"
16
+ payload = "grant_type=#{RailLocatorApi.keycloak_grant_type}&client_id=#{RailLocatorApi.keycloak_client_id}&client_secret=#{RailLocatorApi.keycloak_client_secret}&code=#{code ||RailLocatorApi::Request.access_token}&redirect_uri=#{RailLocatorApi.keycloak_redirect_uri}"
17
17
  end
18
18
  connection = Faraday.new(RailLocatorApi.keycloak_token_url, proxy: nil,
19
19
  ssl: RailLocatorApi::Request.ssl_options || { version: "TLSv1_2" }) do |faraday|
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.1.19
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov