iwoca 1.1.1 → 1.1.3

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: 68021cd07077c3fc000c9a81f8f6016847a9f7e57df374df12648470d86f4e5a
4
- data.tar.gz: 4a27fec8ceba11a0a424dd4543aeeabaf67c4f604bb44f90e6957da199def42e
3
+ metadata.gz: 1e794773b5175154fe894788b44192280f09ca2e5099bf4025d04cb174f02b0a
4
+ data.tar.gz: b5bdaa6ae3e9468cc9db7128037dd210bab12dabb59c153bda687ca466967859
5
5
  SHA512:
6
- metadata.gz: 38da9126aef94769799ad02fd8ea79f102a36d9185907d1028b0aec11380f18b109456d4ee471ef27e3618cb536b5f50cceb2ff3c2d34ac46550ae4e011131a8
7
- data.tar.gz: c36ab903f2341614df679c4e6e2d1851624a15a17d981699b75c08918a2a5a0e5e6dafff3e9ea90245e96b8da9d93f189ec7a7b573c65779af85e73337890d25
6
+ metadata.gz: 20337152817c5b9a26fdedf4fa0615e9aff23aa5e229ff3804c13a32706ef22955d3324cdc24feeb5a4f804ce3d4b4cb5f94e95597ff45edad7c97bc2eceed03
7
+ data.tar.gz: 5392aabef7c29bd74d401e1ecdd1d02cb340ae0370edbb94591b75e8758801e3a23aef1f352b1b65b67bbef5439ae24d6d51525fabdcaf3d107a56fbe497c922
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iwoca (1.1.1)
4
+ iwoca (1.1.3)
5
5
  addressable
6
6
  faraday (~> 2.7)
7
7
  json-schema
@@ -32,7 +32,9 @@ module Iwoca
32
32
  # introducer_id: customer_id
33
33
  # }
34
34
 
35
- JSON::Validator.validate!('lib/iwoca/schemas/requested_product.json', requests)
35
+ schema = File.join(Iwoca.root, 'lib/iwoca/schemas/requested_product.json')
36
+
37
+ JSON::Validator.validate!(schema, requests)
36
38
 
37
39
  Iwoca.connection.post("customers/#{customer_id}/applications/", data)
38
40
  end
@@ -11,8 +11,10 @@ module Iwoca
11
11
  # Successful request will return a 201 status code and a JSON response containing a customer_id:
12
12
  # Example: { data: { customer_id: "fd48781e-3ad3-4a94-b4a6-60fafeebab0b" } }
13
13
  def self.create(data: {})
14
+ schema = File.join(Iwoca.root, 'lib/iwoca/schemas/customer_payload.json')
15
+
14
16
  # Validate the schema first, to avoid making a request with invalid data.
15
- JSON::Validator.validate!('lib/iwoca/schemas/customer_payload.json', data.to_json)
17
+ JSON::Validator.validate!(schema, data.to_json)
16
18
 
17
19
  Iwoca.connection.post('customers/', data)
18
20
  end
data/lib/iwoca/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Iwoca
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.3'
5
5
  end
data/lib/iwoca.rb CHANGED
@@ -12,6 +12,10 @@ require 'rainbow'
12
12
  module Iwoca
13
13
  module_function
14
14
 
15
+ def root
16
+ File.dirname(__dir__)
17
+ end
18
+
15
19
  def configuration
16
20
  @configuration ||= Configuration.new
17
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iwoca
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas