ravelin 0.1.33 → 0.1.38

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: 1e21817ff2cec66a582b1e4fbe3123cfa3f58e0d6645d05eb71b93c1d9079cad
4
- data.tar.gz: be656f247d59729f0c82332ce6dc133ecaa680d609cac7d0c14c6e54e2403a97
3
+ metadata.gz: 4bb2fff6bfc5b74fac97d935a1f0c7cc219ea2c8aa0bf5cab57244a1fc900a4e
4
+ data.tar.gz: 22eaffbcf9436735844d7668d25d1e17cc1f4928ed0fba942dedc781256aa6cf
5
5
  SHA512:
6
- metadata.gz: 1c362ba755c944f70105ab188e407af5daf085b3292a21454438408aed3954e071f1d79d6ac8f3ddbda13c67b4547771813545ebdb51a5cb7d4e1b94aa1bf382
7
- data.tar.gz: c751c7d82c51b62378d01f429a3af52be9067ba8e354384a186273522589813b2f6cb8b9e7cc14a519ad0a63972eef4d5bcc00a3e0428c5bc1ea45e7b37484ea
6
+ metadata.gz: d60eb8693a0e562d3dfeb9a7977a2af2a76a94eba2a683134d73811f584245ad7d90b032168ad659dde9526ca88b32d70dd0b6ca99c3ae1e38cf7179b027e5dd
7
+ data.tar.gz: 6dc208e0f0016bf753c4df24134c5e0ffdf0c7d0581fcf94e97106db7afabe119f3c69f42318feb0ef15afa98d31012f5ebc1ee611f9db8e8eba4c999a4f7bf4
@@ -0,0 +1,27 @@
1
+ module Ravelin
2
+ class App < RavelinObject
3
+ attr_accessor :name, :platform, :domain
4
+
5
+ PLATFORM_IOS = 'ios'
6
+ PLATFORM_ANDROID = 'android'
7
+ PLATFORM_WEB = 'web'
8
+ PLATFORM_MOBILE_WEB = 'mobile-web'
9
+ PLATFORM_VALUES = [PLATFORM_IOS, PLATFORM_ANDROID, PLATFORM_WEB, PLATFORM_MOBILE_WEB]
10
+
11
+ def validate
12
+ super
13
+
14
+ raise ArgumentError, "Platform value be one of #{PLATFORM_VALUES.join(', ')}" unless App.valid_platform?(platform)
15
+ raise ArgumentError, 'Domain is not valid' unless App.valid_domain?(domain)
16
+ end
17
+
18
+ def self.valid_platform?(platform)
19
+ platform.nil? || PLATFORM_VALUES.include?(platform)
20
+ end
21
+
22
+ def self.valid_domain?(domain)
23
+ domain.nil? || /^[a-z0-9\-\\.]+$/.match(domain)
24
+ end
25
+
26
+ end
27
+ end
@@ -11,9 +11,10 @@ module Ravelin
11
11
  class Client
12
12
  API_BASE = 'https://api.ravelin.com'
13
13
 
14
- def initialize(api_key:, api_version: 2)
14
+ def initialize(api_key:, api_version: 2, include_rule_output: false)
15
15
  @api_key = api_key
16
16
  @url_prefix = ''
17
+ @include_rule_output = include_rule_output
17
18
 
18
19
  raise ArgumentError.new("api_version must be 2 or 3") unless [2,3].include? api_version
19
20
  @api_version = api_version
@@ -110,7 +111,7 @@ module Ravelin
110
111
  end
111
112
 
112
113
  def faraday_options
113
- {
114
+ options = {
114
115
  request: { timeout: Ravelin.faraday_timeout },
115
116
  headers: {
116
117
  'Authorization' => "token #{@api_key}",
@@ -118,6 +119,12 @@ module Ravelin
118
119
  'User-Agent' => "Ravelin RubyGem/#{Ravelin::VERSION}".freeze
119
120
  }
120
121
  }
122
+
123
+ if @include_rule_output
124
+ options[:headers]['Accept'] = 'application/vnd.ravelin.score.v2+json'
125
+ end
126
+
127
+ options
121
128
  end
122
129
  end
123
130
  end
data/lib/ravelin/order.rb CHANGED
@@ -13,7 +13,9 @@ module Ravelin
13
13
  :custom,
14
14
  :creation_time,
15
15
  :execution_time,
16
- :status
16
+ :status,
17
+ :app,
18
+ :category
17
19
 
18
20
  attr_required :order_id
19
21
 
@@ -30,5 +32,9 @@ module Ravelin
30
32
  def to=(obj)
31
33
  @to = Ravelin::Location.new(obj)
32
34
  end
35
+
36
+ def app=(obj)
37
+ @app = Ravelin::App.new(obj)
38
+ end
33
39
  end
34
40
  end
@@ -21,7 +21,8 @@ module Ravelin
21
21
  # Only when type = paypal
22
22
  :email,
23
23
  :custom,
24
- :e_wallet
24
+ :e_wallet,
25
+ :scheme
25
26
 
26
27
  attr_required :payment_method_id, :method_type
27
28
  end
@@ -1,10 +1,11 @@
1
1
  module Ravelin
2
2
  class ProxyClient < Client
3
- def initialize(base_url:, username:, password:, api_version: 2)
3
+ def initialize(base_url:, username:, password:, api_version: 2, include_rule_output: false)
4
4
 
5
5
  raise ArgumentError, "api_version must be 2 or 3" unless [2,3].include? api_version
6
6
  @api_version = api_version
7
7
  @url_prefix = '/ravelinproxy'
8
+ @include_rule_output = include_rule_output
8
9
 
9
10
  @connection = Faraday.new(base_url, faraday_proxy_options) do |conn|
10
11
  conn.response :json, context_type: /\bjson$/
@@ -14,13 +15,17 @@ module Ravelin
14
15
  end
15
16
 
16
17
  def faraday_proxy_options
17
- {
18
+ options = {
18
19
  request: { timeout: Ravelin.faraday_timeout },
19
20
  headers: {
20
21
  'Content-Type' => 'application/json; charset=utf-8'.freeze,
21
22
  'User-Agent' => "Ravelin Proxy RubyGem/#{Ravelin::VERSION}".freeze
22
23
  }
23
24
  }
25
+ if @include_rule_output
26
+ options[:headers]['Accept'] = 'application/vnd.ravelin.score.v2+json'
27
+ end
28
+ options
24
29
  end
25
30
  end
26
31
  end
@@ -1,3 +1,3 @@
1
1
  module Ravelin
2
- VERSION = '0.1.33'
2
+ VERSION = '0.1.38'
3
3
  end
data/lib/ravelin.rb CHANGED
@@ -23,6 +23,7 @@ require 'ravelin/item'
23
23
  require 'ravelin/location'
24
24
  require 'ravelin/login'
25
25
  require 'ravelin/order'
26
+ require 'ravelin/app'
26
27
  require 'ravelin/payment_method'
27
28
  require 'ravelin/password'
28
29
  require 'ravelin/pre_transaction'
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.33
4
+ version: 0.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Levy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-11-19 00:00:00.000000000 Z
14
+ date: 2021-10-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -108,6 +108,7 @@ extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
110
  - lib/ravelin.rb
111
+ - lib/ravelin/app.rb
111
112
  - lib/ravelin/ato_login.rb
112
113
  - lib/ravelin/ato_reclaim.rb
113
114
  - lib/ravelin/authentication_mechanism.rb