lenddo 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8e293f5314479875663f5d4a921c438b1e2f5a
4
- data.tar.gz: 248f2ea23a78fb985a71fd8b0043ea273d86aca0
3
+ metadata.gz: 76cff5cf1115df38b405f3bf2bb86f195b660d58
4
+ data.tar.gz: e85834fdd8e08c082fcebee4855036225c697318
5
5
  SHA512:
6
- metadata.gz: f02dceb4e7f200b3b1c5043739648356c488aa008dc79ad1cab9c78f36c3326a790590809cca5e631ac0b93c5c7fdbf31a782b88a91cc97927e99dd642509040
7
- data.tar.gz: 224dcfa80f573d3c72a5ecbdf734fe7a1cbc833efd69b6dbda7ae729ddaf9caf10ac7e7175297b68a2629995c45c3b44ee9454e890c11062d7430a15e989e26c
6
+ metadata.gz: 15493d308e7ac75b721af028829bd308be4b69021591d0d935f9f82470129d841b17583328f0969d3ffd5a324b494b5a6f7701a22669f08cd4a3fde7d0436ebe
7
+ data.tar.gz: 1aba3e001826c7f9204a06a91a5184306d16da68ab82143d62b5f8cdd66e5fe9b79164e9bc23401aa7db2ccc5aa0b96623e052693ca2c0f9ecffda466d80f92d
data/README.md CHANGED
@@ -30,7 +30,7 @@ Before making API calls you need to configure `@access_key` and `@secret_key`. T
30
30
  config.secret_key = @secret_key
31
31
  end
32
32
 
33
- Note: To get your `@access_key` and `@secret_key` go to https://partners.lenddo.com/api_key.
33
+ Note: To get your `@access_key` and `@secret_key` go to https://dashboard.lenddo.com/client/api_key.
34
34
 
35
35
  ## Service Client
36
36
 
@@ -42,6 +42,12 @@ To retrieve the score you'll need the application ID and the partner script ID t
42
42
 
43
43
  Lenddo::ServiceClient.application_score(@application_id, @partnerscript_id)
44
44
 
45
+ ### Get Multiple scores
46
+
47
+ Return an array of LenddoScore records for the supplied application id using models specifically tuned to the applicant pool of the partner associated with the current API user. LenddoScore is a measure of the expected creditworthiness of a Lenddo user. It ranges is from 0 (the highest risk) to 1000 (the lowest risk). Lenddo's scoring algorithms consider over 300 features per user when generating a score. These features are calculated from Lenddo's proprietary social graph as well as from any data specifically shared by the partner. In the event that a score cannot be correctly calculated, the LenddoScore will be returned as -1 along with an array of flag codes.
48
+
49
+ Lenddo::ServiceClient.application_multiple_scores(@application_id, @partnerscript_id)
50
+
45
51
  ### Get a Verification
46
52
 
47
53
  To retrieve the verification you'll need the application ID and the partner script ID that you used to create the application.
@@ -92,7 +98,7 @@ OAuth secret - optional, leave null if not applicable. Some OAuth providers may
92
98
 
93
99
  4. **token data** - This is the raw token as it was received from the provider in an Array format. This may include a **extra_data** key.
94
100
 
95
- Lenddo::WhiteLabelClient.partner_token(application_id, provider, oauth_key, oauth_secret, token_data)
101
+ `Lenddo::WhiteLabelClient.partner_token(application_id, provider, oauth_key, oauth_secret, token_data)`
96
102
 
97
103
  #### Errors
98
104
 
@@ -116,9 +122,13 @@ CommitPartnerJob has the following arguments:
116
122
 
117
123
  4. **verification** - This is an optional argument which will allow you to send probe data with the verification object.
118
124
 
119
- Lenddo::WhiteLabelClient.commit_partner_job(partnerscript_id, application_id, profile_ids, verification)
125
+ `Lenddo::WhiteLabelClient.commit_partner_job(partnerscript_id, application_id, profile_ids, verification)`
120
126
 
121
- #### Errors
127
+ ### Errors
128
+
129
+ * **ACCEPTED** *HTTP Status Code: 202* Strictly speaking, not an error. This status code indicates that not enough data has been gathered to compute the applicant's scores, but data will be available in the future.
130
+
131
+ * **NOT_FOUND** *HTTP Status Code: 404* The specified application_id was not found
122
132
 
123
133
  * **BAD_REQUEST** *HTTP Status Code: 400* Request was malformed, or missing required data.
124
134
 
data/lenddo.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.14"
24
- spec.add_development_dependency "curb", "~> 0.9"
24
+ spec.add_development_dependency "curb", "~> 0.9.3"
25
25
  spec.add_development_dependency "json", "~> 1.8"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -5,16 +5,19 @@ require 'openssl'
5
5
 
6
6
  module Lenddo
7
7
  module Authentication
8
- def signed_request(method, host, path, params={})
9
- uri = URI.parse(host + path)
8
+ def signed_request(args)
9
+ host = args[:host]
10
+ method = args[:method].downcase
11
+ path = args[:path]
12
+ params = args[:params]
10
13
 
11
- method = method.downcase
12
14
  if (method == 'post' || method == 'put')
13
15
  body = params
14
16
  else
15
17
  body = {}
16
18
  end
17
19
 
20
+ uri = URI.parse(host + path)
18
21
  Curl.send(method.to_s, uri.to_s, params) do |http|
19
22
  headers = sign(method.upcase, path, body)
20
23
  headers.each do |key, value|
@@ -7,23 +7,30 @@ module Lenddo
7
7
  module ServiceClient
8
8
  class << self
9
9
  attr_accessor :score_service
10
- # Calls the Lenddo Service with the provided application_id to return a application score result.
10
+ # Calls the Lenddo Service with the provided application_id and partner_script_id to return a application score result.
11
11
  # @param string application_id
12
- # @param string partner_script_id
12
+ # @param string partnerscript_id
13
13
  def application_score(application_id, partnerscript_id)
14
14
  @score_service ||= ScoreService.new
15
15
  @score_service.application_score(application_id, partnerscript_id)
16
16
  end
17
- # Calls the Lenddo Service with the provided application id to return a application verification result.
17
+ # Calls the Lenddo Service with the provided application_id and partner_script_id to return an array of LenddoScore records
18
18
  # @param string application_id
19
- # @param string partner_script_id
19
+ # @param string partnerscript_id
20
+ def application_multiple_scores(application_id, partnerscript_id)
21
+ @score_service ||= ScoreService.new
22
+ @score_service.application_multiple_scores(application_id, partnerscript_id)
23
+ end
24
+ # Calls the Lenddo Service with the provided application_id and partner_script_idto return a application verification result.
25
+ # @param string application_id
26
+ # @param string partnerscript_id
20
27
  def application_verification(application_id, partnerscript_id)
21
28
  @score_service ||= ScoreService.new
22
29
  @score_service.application_verification(application_id, partnerscript_id)
23
30
  end
24
- # Calls the Lenddo Service with the provided application id to return a application decision result.
31
+ # Calls the Lenddo Service with the provided application_id and partner_script_id to return a application decision result.
25
32
  # @param string application_id
26
- # @param string partner_script_id
33
+ # @param string partnerscript_id
27
34
  def application_decision(application_id, partnerscript_id)
28
35
  @score_service ||= ScoreService.new
29
36
  @score_service.application_decision(application_id, partnerscript_id)
@@ -3,30 +3,40 @@ module Lenddo
3
3
  class ScoreService
4
4
  def application_score(application_id, partnerscript_id)
5
5
  response = signed_request(
6
- "GET",
7
- Lenddo.configuration.score_service,
8
- "/ClientScore/#{application_id}",
9
- { "partner_script_id" => partnerscript_id }
6
+ method: "GET",
7
+ host: Lenddo.configuration.score_service,
8
+ path: "/ClientScore/#{application_id}",
9
+ params: { "partner_script_id" => partnerscript_id }
10
+ )
11
+ JSON.parse(response.body)
12
+ end
13
+
14
+ def application_multiple_scores(application_id, partnerscript_id)
15
+ response = signed_request(
16
+ method: "GET",
17
+ host: Lenddo.configuration.score_service,
18
+ path: "/ApplicationMultipleScores/#{application_id}",
19
+ params: { "partner_script_id" => partnerscript_id }
10
20
  )
11
21
  JSON.parse(response.body)
12
22
  end
13
23
 
14
24
  def application_verification(application_id, partnerscript_id)
15
25
  response = signed_request(
16
- "GET",
17
- Lenddo.configuration.score_service,
18
- "/ClientVerification/#{application_id}",
19
- { "partner_script_id" => partnerscript_id }
26
+ method: "GET",
27
+ host: Lenddo.configuration.score_service,
28
+ path: "/ClientVerification/#{application_id}",
29
+ params: { "partner_script_id" => partnerscript_id }
20
30
  )
21
31
  JSON.parse(response.body)
22
32
  end
23
33
 
24
34
  def application_decision(application_id, partnerscript_id)
25
35
  response = signed_request(
26
- "GET",
27
- Lenddo.configuration.score_service,
28
- "/ApplicationDecision/#{application_id}",
29
- { "partner_script_id" => partnerscript_id}
36
+ method: "GET",
37
+ host: Lenddo.configuration.score_service,
38
+ path: "/ApplicationDecision/#{application_id}",
39
+ params: { "partner_script_id" => partnerscript_id }
30
40
  )
31
41
  JSON.parse(response.body)
32
42
  end
@@ -1,5 +1,5 @@
1
1
  module Lenddo
2
2
  def self.version
3
- "1.0.1"
3
+ "1.1.0"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ module Lenddo
9
9
  attr_accessor :network_service
10
10
  # Submit additional data about an application to Lenddo.
11
11
  # @param string application_id
12
- # @param string partner_script_id
12
+ # @param string partnerscript_id
13
13
  # @param array extra_data
14
14
  def extra_application_data(application_id, partnerscript_id, extra_data = {})
15
15
  @network_service ||= NetworkService.new
@@ -37,7 +37,7 @@ module Lenddo
37
37
  end
38
38
  # Submit an application with profile ids for scoring to Lenddo.
39
39
  # To perform this step you must have an array of at least one profile id obtained from the PartnerToken call.
40
- # @param string partner_script_id
40
+ # @param string partnerscript_id
41
41
  # @param string application_id
42
42
  # @param array profile_ids
43
43
  # @param verification - Optional
@@ -3,10 +3,10 @@ module Lenddo
3
3
  class NetworkService
4
4
  def extra_application_data(application_id, partnerscript_id, extra_data)
5
5
  response = signed_request(
6
- "POST",
7
- Lenddo.configuration.network_service,
8
- "/ExtraApplicationData",
9
- { "application_id" => application_id, "partner_script_id" => partnerscript_id, "extra_data" => extra_data }
6
+ method: "POST",
7
+ host: Lenddo.configuration.network_service,
8
+ path: "/ExtraApplicationData",
9
+ params: { "application_id" => application_id, "partner_script_id" => partnerscript_id, "extra_data" => extra_data }
10
10
  )
11
11
  JSON.parse(response.body)
12
12
  end
@@ -15,20 +15,20 @@ module Lenddo
15
15
  body = { "token_data" => { "key" => oauth_key, "secret" => oauth_secret }, "provider" => provider, "client_id" => application_id }
16
16
  body['token_data'].merge!(token_data)
17
17
  response = signed_request(
18
- "POST",
19
- Lenddo.configuration.network_service,
20
- "/PartnerToken",
21
- body
18
+ method: "POST",
19
+ host: Lenddo.configuration.network_service,
20
+ path: "/PartnerToken",
21
+ params: body
22
22
  )
23
23
  JSON.parse(response.body)
24
24
  end
25
25
 
26
26
  def commit_partner_job(partnerscript_id, application_id, profile_ids, verification)
27
27
  response = signed_request(
28
- "POST",
29
- Lenddo.configuration.network_service,
30
- "/CommitPartnerJob",
31
- { "client_id" => application_id, "profile_ids" => profile_ids, "partner_script_id" => partnerscript_id, "verification_data" => verification}
28
+ method: "POST",
29
+ host: Lenddo.configuration.network_service,
30
+ path: "/CommitPartnerJob",
31
+ params: { "client_id" => application_id, "profile_ids" => profile_ids, "partner_script_id" => partnerscript_id, "verification_data" => verification }
32
32
  )
33
33
  JSON.parse(response.body)
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lenddo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - arjay salvadora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: 0.9.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.9'
40
+ version: 0.9.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement