ravelin 0.1.7 → 0.1.8

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: 9c386b1036368c92c7f077bbefccf8e42addf9b6
4
- data.tar.gz: 5129f6ff9570d295569498722cc0ce7f3488588d
3
+ metadata.gz: cc46a8d84598d37d617b1849c308a07a3a9d6c80
4
+ data.tar.gz: 89720381c525d4f99fa568cba498d3e9fd686bb6
5
5
  SHA512:
6
- metadata.gz: dad24150d4298d44d139f696f4c9f608d968e21aef21e572e299ec73a65b87b213e29ed4eb65d768b8927de70978dfe405c7871207ffbbc38bbba5acae2eec49
7
- data.tar.gz: 655c9c5577f278fa94777bc5dbc2e146fe0fb016bea995167688d82498076a1a1dc993ccf7898db50030bc5934a92dc48d081fdfd57bd8135d6ae988b4a34652
6
+ metadata.gz: 43d94d6e7e32f017c18a5e38aaea8de8fc773fc1d57ca8199a4846ea388c91dbafd7058835de3646f648e009d6eb98f521cf37fafd0bc48fcde33205f849230a
7
+ data.tar.gz: 173c6e1c612e48f0518720248c308a41c29e8b0098f55a2de8ed86e7aeb0b339f20a3767ca7e465d98716ef0914dfe9de1afac2ddc957fabe728d560e4ad1303
data/lib/ravelin.rb CHANGED
@@ -20,6 +20,7 @@ require 'ravelin/location'
20
20
  require 'ravelin/order'
21
21
  require 'ravelin/payment_method'
22
22
  require 'ravelin/pre_transaction'
23
+ require 'ravelin/three_d_secure'
23
24
  require 'ravelin/transaction'
24
25
  require 'ravelin/voucher'
25
26
  require 'ravelin/voucher_redemption'
@@ -36,9 +37,10 @@ module Ravelin
36
37
  class << self
37
38
  attr_accessor :faraday_adapter, :faraday_timeout
38
39
 
39
- def camelize(str)
40
- return '3ds' if str == :three_d_secure # hack to get around Ruby not support 3ds an attribute.
41
- str.to_s.gsub(/_(.)/) { |e| $1.upcase }
40
+ def camelize(key)
41
+ return '3ds' if key == :three_d_secure
42
+
43
+ key.to_s.gsub(/_(.)/) { Regexp.last_match(1).upcase }
42
44
  end
43
45
 
44
46
  def datetime_to_epoch(val)
@@ -0,0 +1,29 @@
1
+ module Ravelin
2
+ class ThreeDSecure < RavelinObject
3
+ attr_accessor :attempted,
4
+ :success,
5
+ :start_time,
6
+ :end_time,
7
+ :timed_out
8
+
9
+ def serializable_hash
10
+ {
11
+ 'attempted' => boolean(attempted),
12
+ 'success' => boolean(success),
13
+ 'startTime' => timestamp(start_time),
14
+ 'endTime' => timestamp(end_time),
15
+ 'timedOut' => boolean(timed_out)
16
+ }
17
+ end
18
+
19
+ private
20
+
21
+ def boolean(bool)
22
+ bool || false
23
+ end
24
+
25
+ def timestamp(time)
26
+ time.to_i
27
+ end
28
+ end
29
+ end
@@ -26,9 +26,8 @@ module Ravelin
26
26
  :success
27
27
 
28
28
  def initialize(params)
29
- three_d_secure_data = params['3ds']
30
- unless three_d_secure_data.nil?
31
- self.three_d_secure = three_d_secure_data
29
+ unless params['3ds'].nil?
30
+ self.three_d_secure = ThreeDSecure.new(params['3ds'])
32
31
  params.delete('3ds')
33
32
  end
34
33
 
@@ -1,3 +1,3 @@
1
1
  module Ravelin
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravelin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Levy
@@ -126,6 +126,7 @@ files:
126
126
  - lib/ravelin/pre_transaction.rb
127
127
  - lib/ravelin/ravelin_object.rb
128
128
  - lib/ravelin/response.rb
129
+ - lib/ravelin/three_d_secure.rb
129
130
  - lib/ravelin/transaction.rb
130
131
  - lib/ravelin/version.rb
131
132
  - lib/ravelin/voucher.rb