janio_api 0.3.3 → 0.3.4

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: e57c2ea2a0a13ddc13f64b70dedaa02c7b940f0b04cf926c115d64190b047ef8
4
- data.tar.gz: aac6b0f91383b97228e50dddce705c049f09657ba5cdbf1af5e99180068c0f1c
3
+ metadata.gz: ec588d4ddedcb71c4d1038732fe2db5864cacc915b2d4f0e257feedafd5916d7
4
+ data.tar.gz: ccb59b3ec045bcd86029fbd301e909a2919a94c000f1e098f780a9e99ccf53f2
5
5
  SHA512:
6
- metadata.gz: 79597cc7d1907306f897fb35e35f2ac060d6b894b2181dd45eaf1cd982174db462270319448c842c143ee158b5bfae448a26862ee067b68758a66c4f7a202e7c
7
- data.tar.gz: d4b320389f56fa3a8f9962c08360e5e4dcff3a8c6f6f782ad8f5793721a61d63fbd4ffff6bee6d5e202fb11aa535f6069c0e27097569028063686a8db8720900
6
+ metadata.gz: 868e7843a0cfdfa019f48fc2eaf0df991e2aeb0369e012aa2cb2407c53cc3865b1fc5f83f6fae8ac6b42e00ee945edf8014be90b00a5ada8f41adc9740549857
7
+ data.tar.gz: d946eca197b5186140ba4741cd90cbdbd15b44b66da94d2ceb54edf4be9d7a5a2013551a8d476d3f5cd55e1db87e572781e19bbb443ac37e44eb672dd23d3fe9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- janio_api (0.3.3)
4
+ janio_api (0.3.4)
5
5
  activeresource
6
6
  countries
7
7
  phonelib
@@ -220,16 +220,16 @@ module JanioAPI
220
220
  def reformat_before_save(blocking)
221
221
  attributes = @attributes.dup
222
222
  @attributes.clear
223
- @attributes[:secret_key] = retrieve_api_token
223
+ @attributes[:secret_key] = retrieve_api_token(attributes[:pickup_country])
224
224
  # set blocking until label generated
225
225
  @attributes[:blocking] = blocking
226
226
  # reformat attributes
227
227
  @attributes[:orders] = [attributes]
228
228
  end
229
229
 
230
- def retrieve_api_token
230
+ def retrieve_api_token(country)
231
231
  if JanioAPI.config.api_tokens
232
- country_code_sym = ISO3166::Country.find_country_by_name(@attributes[:pickup_country])&.alpha2&.to_sym
232
+ country_code_sym = ISO3166::Country.find_country_by_name(country)&.alpha2&.to_sym
233
233
  JanioAPI.config.api_tokens[country_code_sym]
234
234
  elsif JanioAPI.config.api_token
235
235
  JanioAPI.config.api_token
@@ -1,3 +1,3 @@
1
1
  module JanioAPI
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: janio_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Chong
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource