valken-shipping 0.1.0 → 0.1.1

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: e84c0d4116d7966aa6f084fdf5fe4b18fe78fa8a7b4ae0e0ccf0da055dba6827
4
- data.tar.gz: 0e75818f95bc1434dc81cccd4dc1f6f9d97a80db445d9246ce3ee14f6f4d352a
3
+ metadata.gz: 04745f3ed0c5ecabf3975b0f071f244dbff18a6374f81feae40d39f4f546656c
4
+ data.tar.gz: 7a3073049e68c67f11b3764e1fc68c01479313f75c1d37f803b574629a2e9eb4
5
5
  SHA512:
6
- metadata.gz: dd4fb785e8735a2c80b833d8c0cce78dc2e88b235f0256320d1df3574679fda4d382b7a57752e7c8cfdc0f9976c54c8f28a3e5a44134e0406787a46a0a814c38
7
- data.tar.gz: 6b977128805bc0b99b50bbb10429eec3fc759d0bdd926808e56bd71b655f0426ab50773af3f31fd2d3f072007a1af06e7d86e93753b6211d152e702b7d4ab09d
6
+ metadata.gz: aa58934d2b87f6f334fe5461d2c0c02c91e01984344bdaa0964af467052cad20774de90f2c61ec1afd49a21ba8748a67d121f7871e07aea74161823678ce0b47
7
+ data.tar.gz: d5bd1cfe4fe351ce5e92cb9c8ae6863c01d1d9ce8df254e89f6dfaf370b66139122803b80f2f605138c16d55a8d3aeaa3b742bfde167562aa1841aa81b110c0a
@@ -34,11 +34,11 @@ module Workarea
34
34
  end
35
35
 
36
36
  def get_ups_data
37
- ups_options = get_options(ActiveShipping::UPS.new(Rails.application.secrets.ups_carrier), Workarea.config.ups_options)
37
+ ups_options = get_options(Workarea.config.gateways.ups_carrier, Workarea.config.ups_options)
38
38
  end
39
39
 
40
40
  def get_fedex_data
41
- fedex_response = get_options(ActiveShipping::FedEx.new(Rails.application.secrets.fedex_carrier), Workarea.config.fedex_options)
41
+ fedex_response = get_options(Workarea.config.gateways.fedex_carrier, Workarea.config.fedex_options)
42
42
  end
43
43
 
44
44
  def get_none_data
@@ -1,3 +1,5 @@
1
+ Valken::Shipping.auto_initialize_gateway
2
+
1
3
  Workarea.configure do |config|
2
4
  config.weight_table = {"2": 5, "15": 15, "200": 1, "2500": 200}
3
5
 
@@ -1,7 +1,42 @@
1
+ require 'workarea'
2
+ require 'workarea/storefront'
3
+ require 'workarea/admin'
1
4
  require "valken/shipping/engine"
2
5
 
3
6
  module Valken
4
7
  module Shipping
5
- # Your code goes here...
8
+
9
+ def self.ups_credentials
10
+ return {} unless Rails.application.secrets.ups_carrier.present?
11
+ Rails.application.secrets.ups_carrier.symbolize_keys
12
+ end
13
+
14
+ def self.fedex_credentials
15
+ return {} unless Rails.application.secrets.fedex_carrier.present?
16
+ Rails.application.secrets.fedex_carrier.symbolize_keys
17
+ end
18
+
19
+ def self.ups_gateway=(gateway)
20
+ Workarea.config.gateways.ups_carrier = gateway
21
+ end
22
+
23
+ def self.fedex_gateway=(gateway)
24
+ Workarea.config.gateways.fedex_carrier = gateway
25
+ end
26
+
27
+ def self.auto_initialize_gateway
28
+ if ups_credentials.present? && fedex_credentials.present?
29
+ if Rails.env.test?
30
+ self.ups_gateway = ActiveShipping::Workarea.new
31
+ self.fedex_gateway = ActiveShipping::Workarea.new
32
+ else
33
+ self.ups_gateway = ActiveShipping::UPS.new credentials
34
+ self.fedex_gateway = ActiveShipping::FedEx.new credentials
35
+ end
36
+ else
37
+ self.ups_gateway = ActiveShipping::Workarea.new
38
+ self.fedex_gateway = ActiveShipping::Workarea.new
39
+ end
40
+ end
6
41
  end
7
- end
42
+ end
@@ -1,5 +1,5 @@
1
1
  module Valken
2
2
  module Shipping
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valken-shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sushmitha02
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-23 00:00:00.000000000 Z
11
+ date: 2020-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails