rail-locator-api 1.0.17 → 1.0.19

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: 3ecb5cb1204014eceb1b9078581d3087cc654bac09651346ad9400e565cb59b7
4
- data.tar.gz: 903f53daec2bf659b6275e570157697a2eef5d8ae7dfe0cd225514137a248392
3
+ metadata.gz: 0a40601fc87134ba69f0409934667e771432a08c62928b0ba2097d8a8bb8407b
4
+ data.tar.gz: afac1cbc06cc1f251759ea16b2a98081d523bc6f9f3c96a5b999acd02b264205
5
5
  SHA512:
6
- metadata.gz: 133889e2f13630c3db16f2acad96df608b8deb4c6596ca5a5e353648b017d0e22b006b6c17764d0af7d7f44fd70287b4eeb6a00378d277032978b9fd53eb1272
7
- data.tar.gz: 3207f49bb24d1dabd2a74e421c8909b3186e94153dc300ce18aecbf724167f50218f025445a06e0dda8cb32047d3af285b37e175bc963cdd0e392ee4e08d6c04
6
+ metadata.gz: 247cad136e02ebbf243315cd1b7ba0ba23a9b56aac25539ba5bccd9d17002c3b57aad72ad66f5464f5baf3c490102419d1251595d1291f624dd08a343e6c2c6c
7
+ data.tar.gz: a462fba2edf6a68175fd670e08302c89d995ba6d61991366cf024db1a0ed02ca7c9a2c3e053e902b967b1aa02e1e164a7a5eee8771307783f9c6f757cab638f5
@@ -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
@@ -274,6 +278,8 @@ module RailLocatorApi
274
278
  url = case @request_builder.path_parts.first
275
279
  when "lk"
276
280
  lk_api_url
281
+ when "notify"
282
+ notify_api_url
277
283
  when "app"
278
284
  app_api_url
279
285
  when "union"
@@ -298,7 +304,11 @@ module RailLocatorApi
298
304
  end
299
305
 
300
306
  def union_api_url
301
- "http://192.168.88.38:8000/api/v1.0/"
307
+ "#{RailLocatorApi.union_endpoint}/api/v1.0/"
308
+ end
309
+
310
+ def notify_api_url
311
+ "http://192.168.1.153:3003"
302
312
  end
303
313
  end
304
314
  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.19"
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.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov