rail-locator-api 1.0.17 → 1.0.18

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: 3ecb5cb1204014eceb1b9078581d3087cc654bac09651346ad9400e565cb59b7
4
- data.tar.gz: 903f53daec2bf659b6275e570157697a2eef5d8ae7dfe0cd225514137a248392
3
+ metadata.gz: 1edc312aa5f07d150eb51199c45261714727ceb928926c0d1abf8eafca2af2d0
4
+ data.tar.gz: f2417580821577d93871b56b4d31d3f062be455d1ab5371ff5d7773fb5dd42cc
5
5
  SHA512:
6
- metadata.gz: 133889e2f13630c3db16f2acad96df608b8deb4c6596ca5a5e353648b017d0e22b006b6c17764d0af7d7f44fd70287b4eeb6a00378d277032978b9fd53eb1272
7
- data.tar.gz: 3207f49bb24d1dabd2a74e421c8909b3186e94153dc300ce18aecbf724167f50218f025445a06e0dda8cb32047d3af285b37e175bc963cdd0e392ee4e08d6c04
6
+ metadata.gz: 254c38cbae810b90ae2db2d53dbc5be043a18169b33b40e558651d5c051af1300825b56c5d61bdf964da4a8676e5579bcf6890e18aa2ab28f50d5f800846477a
7
+ data.tar.gz: e7e6a777359ecebf0170efa6542545304268fafdfdcb5bb8323a512227e110602dc52a2e874b29e8fb18b6bb111d8ceaf9d2d996856d588b7d7413fbd688c4ee
@@ -1,5 +1,6 @@
1
1
  defaults: &defaults
2
2
  API_ENDPOINT: "https://rail-scan.com"
3
+ UNION_ENDPOINT: "http://192.168.88.38:8000"
3
4
 
4
5
  API_AUTH_METHOD: "api_key"
5
6
  API_KEY: "***"
@@ -14,6 +15,7 @@ defaults: &defaults
14
15
  KEYCLOAK_REDIRECT_URI: "http://yousite.ru/callback"
15
16
  production:
16
17
  <<: *defaults
18
+ UNION_ENDPOINT: "http://192.168.1.88:3500"
17
19
  development:
18
20
  <<: *defaults
19
21
  test:
@@ -122,6 +122,10 @@ module RailLocatorApi
122
122
  @request_builder.api_endpoint
123
123
  end
124
124
 
125
+ def union_endpoint
126
+ @request_builder.union_endpoint
127
+ end
128
+
125
129
  def timeout
126
130
  @request_builder.timeout
127
131
  end
@@ -253,7 +257,7 @@ module RailLocatorApi
253
257
  def validate_api_key
254
258
  case self.api_auth_method
255
259
  when :api_key
256
- unless self.api_key && self.api_endpoint
260
+ unless self.api_key# && self.api_endpoint
257
261
  raise RailLocatorApi::RailLocatorApiError, "You must set an api_key prior to making a call #{self.api_key} #{self.api_endpoint}"
258
262
  end
259
263
  when :base64
@@ -298,7 +302,7 @@ module RailLocatorApi
298
302
  end
299
303
 
300
304
  def union_api_url
301
- "http://192.168.88.38:8000/api/v1.0/"
305
+ "#{RailLocatorApi.union_endpoint}/api/v1.0/"
302
306
  end
303
307
  end
304
308
  end
@@ -1,6 +1,7 @@
1
1
  module RailLocatorApi
2
2
  class Request
3
- attr_accessor :access_token, :refresh_token, :api_user_id, :api_key, :api_user_email, :api_user_password, :api_auth_method, :api_endpoint,
3
+ attr_accessor :access_token, :refresh_token, :api_user_id, :api_key, :api_user_email, :api_user_password,
4
+ :api_auth_method, :api_endpoint, :union_endpoint,
4
5
  :timeout, :open_timeout, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys, :debug, :debug_options,
5
6
  :without_ratelimit, :is_allow_access_to_coordinates, :logger, :test, :language
6
7
 
@@ -11,7 +12,7 @@ module RailLocatorApi
11
12
  DEFAULT_LANGUAGE = :ru
12
13
 
13
14
  def initialize(access_token: nil, refresh_token: nil, api_user_id: nil, api_key: nil, api_user_email: nil, api_user_password: nil,
14
- api_endpoint: nil, api_auth_method: nil, timeout: nil, open_timeout: nil, proxy: nil, ssl_options: nil,
15
+ api_endpoint: nil, union_endpoint: nil, api_auth_method: nil, timeout: nil, open_timeout: nil, proxy: nil, ssl_options: nil,
15
16
  faraday_adapter: nil, symbolize_keys: false, debug: false,
16
17
  debug_options: { headers: true, bodies: false, errors: false, log_level: :info },
17
18
  without_ratelimit: false, is_allow_access_to_coordinates: false,
@@ -35,8 +36,12 @@ module RailLocatorApi
35
36
 
36
37
  @api_user_email = api_user_email || ENV['API_USER_EMAIL'] || ""
37
38
  @api_user_password = api_user_password || ENV['API_USER_PASSWORD'] || ""
39
+
38
40
  @api_endpoint = api_endpoint || self.class.api_endpoint
39
41
  @api_endpoint = RailLocatorApi::api_endpoint if @api_endpoint.nil?
42
+ @union_endpoint = union_endpoint || self.class.union_endpoint
43
+ @union_endpoint = RailLocatorApi::union_endpoint if @union_endpoint.nil?
44
+
40
45
  @api_auth_method = api_auth_method || RailLocatorApi::api_auth_method || DEFAULT_AUTH_METHOD
41
46
  @timeout = timeout || self.class.timeout || DEFAULT_TIMEOUT
42
47
  @open_timeout = open_timeout || self.class.open_timeout || DEFAULT_OPEN_TIMEOUT
@@ -130,7 +135,7 @@ module RailLocatorApi
130
135
 
131
136
  class << self
132
137
  attr_accessor :access_token, :refresh_token, :api_user_id, :api_key, :api_user_email, :api_user_password, :api_auth_method,
133
- :timeout, :open_timeout, :api_endpoint, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys,
138
+ :timeout, :open_timeout, :api_endpoint, :union_endpoint, :proxy, :ssl_options, :faraday_adapter, :symbolize_keys,
134
139
  :debug, :debug_options, :without_ratelimit, :is_allow_access_to_coordinates, :logger, :test, :language
135
140
 
136
141
  def method_missing(sym, *args, &block)
@@ -138,7 +143,7 @@ module RailLocatorApi
138
143
  api_user_id: self.api_user_id,
139
144
  api_key: self.api_key,
140
145
  api_user_email: self.api_user_email, api_user_password: self.api_user_password,
141
- api_auth_method: self.api_auth_method, api_endpoint: self.api_endpoint,
146
+ api_auth_method: self.api_auth_method, api_endpoint: self.api_endpoint, union_endpoint: self.union_endpoint,
142
147
  timeout: self.timeout, open_timeout: self.open_timeout, faraday_adapter: self.faraday_adapter,
143
148
  symbolize_keys: self.symbolize_keys, debug: self.debug, debug_options: self.debug_options,
144
149
  without_ratelimit: self.without_ratelimit,
@@ -1,3 +1,3 @@
1
1
  module RailLocatorApi
2
- VERSION = "1.0.17"
2
+ VERSION = "1.0.18"
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: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov