flowcommerce-solidus 0.1.12 → 0.1.13

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
  SHA1:
3
- metadata.gz: 7dc5caf05326a4cca8e512be102b74b784f48145
4
- data.tar.gz: 42063f71e4af7586d9989627a78eeeb2cbd5e9ea
3
+ metadata.gz: 62942081ca63c1cb57bc7afe28472d1bfef9dc0c
4
+ data.tar.gz: 6ba9ee41350c15edf9359b9f3ead5be1a6f5c224
5
5
  SHA512:
6
- metadata.gz: df425ba922fce210fcee1bad090af046bacb685be895a563d85fa67d98c5284c1669d97f41c257252c7a556989222095c78f866a7ab7ef84005ffb369105638c
7
- data.tar.gz: 1e2efbe81e86efa045ae51db86d038b9a6abaf0b2388333e2fe70f463419736b00939329999077733052f9e15bbce587f005c06465c027a56fc17c99610f4a0d
6
+ metadata.gz: eacbef2a5892adf9e098de565af1a58acc400c5177df427b9e2e0a16db74d2853a2caa51bc59906639c2b3086d901d52f8d3fc83a13775598fe289b5aade5cfa
7
+ data.tar.gz: e1bef19fc7e259673e4f2d33588aef9a78b9cf7bc2a5cf4d61089eb50d7c40d5c19c64f7b7c5b65eff0ce8b0d410efa1d98070b8b6849e4270110969ed961ebf
data/.version CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
@@ -2,15 +2,14 @@
2
2
  # for now all in same class
3
3
 
4
4
  require 'logger'
5
- require 'awesome_print'
6
5
 
7
6
  module Flow
8
- mattr_accessor :organization
9
- mattr_accessor :base_country
10
- mattr_accessor :api_key
11
-
12
7
  extend self
13
8
 
9
+ def organization() ENV.fetch('FLOW_ORGANIZATION') end
10
+ def base_country() ENV.fetch('FLOW_BASE_COUNTRY') end
11
+ def api_key() ENV.fetch('FLOW_API_KEY') end
12
+
14
13
  # builds curl command and gets remote data
15
14
  def api action, path, params={}, body=nil
16
15
  body ||= params.delete(:BODY)
@@ -41,13 +40,12 @@ module Flow
41
40
 
42
41
  data = JSON.load `#{command}`
43
42
 
44
- ap data if data.kind_of?(Hash) && data['code'] == 'generic_error'
45
-
46
- data
47
- end
48
-
49
- def log_api_error
50
-
43
+ if data.kind_of?(Hash) && data['code'] == 'generic_error'
44
+ ap data
45
+ data
46
+ else
47
+ data
48
+ end
51
49
  end
52
50
 
53
51
  def logger
@@ -1,12 +1,12 @@
1
1
  # Flow (2017)
2
- # for flow errors
2
+ # api error logger and formater
3
3
 
4
4
  require 'digest/sha1'
5
5
 
6
6
  class Flow::Error < StandardError
7
7
 
8
8
  # logs error to file for easy discovery and fix
9
- def self.log(exception, request)
9
+ def self.log exception, request
10
10
  history = exception.backtrace.reject{ |el| el.index('/gems/') }.map{ |el| el.sub(Rails.root.to_s, '') }.join($/)
11
11
 
12
12
  msg = '%s in %s' % [exception.class, request.url]
@@ -1,3 +1,5 @@
1
+ # Flow.io (2017)
2
+
1
3
  # represents flow.io order
2
4
  # for easy intgration we pass current
3
5
  # - flow experirnce
@@ -1,5 +1,5 @@
1
1
  # Flow.io (2017)
2
- # communicates with flow api, responds to webhook events
2
+ # communicates with flow api to synchronize Solidus order with PayPal
3
3
 
4
4
  module Flow::PayPal
5
5
  extend self
@@ -1,5 +1,5 @@
1
1
  # Flow.io (2017)
2
- # communicates with flow api, easy access to session
2
+ # communicates with flow api, easy access to session
3
3
 
4
4
  class Flow::Session
5
5
  attr_accessor :session, :localized, :visitor
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowcommerce-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flow.io (Dino Reic)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,7 +118,6 @@ files:
118
118
  - "./static/app/flow/flow/order.rb"
119
119
  - "./static/app/flow/flow/pay_pal.rb"
120
120
  - "./static/app/flow/flow/session.rb"
121
- - "./static/app/flow/flow/simple_crypt.rb"
122
121
  - "./static/app/flow/flow/simple_gateway.rb"
123
122
  - "./static/app/flow/flow/webhook.rb"
124
123
  - "./static/app/flow/lib/flow_api_refresh.rb"
@@ -1,30 +0,0 @@
1
- # Flow.io (2017)
2
- # Module uses rails engine for encrypt and decrypt
3
-
4
- # example
5
- # enc1 = Flow::SimpleCrypt.encrypt('foo')
6
- # Flow::SimpleCrypt.encrypt(enc1)
7
- #
8
- # example with salt
9
- # enc2 = Flow::SimpleCrypt.encrypt('bar', '127.0.0.1')
10
- # Flow::SimpleCrypt.encrypt(enc2) # raises error: ActiveSupport::MessageVerifier::InvalidSignature
11
- # Flow::SimpleCrypt.encrypt(enc2, '127.0.0.1') # ok
12
-
13
- module Flow::SimpleCrypt
14
- extend self
15
-
16
- def encrypt_base(salt)
17
- local_secret = Rails.application.secrets.secret_key_base[0,32]
18
- key = ActiveSupport::KeyGenerator.new(local_secret).generate_key(salt || '', 32)
19
-
20
- ActiveSupport::MessageEncryptor.new(key)
21
- end
22
-
23
- def encrypt(raw_data, salt=nil)
24
- encrypt_base(salt).encrypt_and_sign(raw_data)
25
- end
26
-
27
- def decrypt(enc_data, salt=nil)
28
- encrypt_base(salt).decrypt_and_verify(enc_data)
29
- end
30
- end