Module: Lenddo::WhiteLabelClient

Defined in:
lib/lenddo/white_label_client.rb,
lib/lenddo/white_label_client/network_service.rb

Defined Under Namespace

Classes: NetworkService

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.network_serviceObject

Returns the value of attribute network_service.



10
11
12
# File 'lib/lenddo/white_label_client.rb', line 10

def network_service
  @network_service
end

Class Method Details

.commit_partner_job(partnerscript_id, application_id, profile_ids, verification = nil) ⇒ Object

Submit an application with profile ids for scoring to Lenddo. To perform this step you must have an array of at least one profile id obtained from the PartnerToken call.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/lenddo/white_label_client.rb', line 47

def commit_partner_job(partnerscript_id, application_id, profile_ids, verification = nil)
  @network_service ||= NetworkService.new

  if !profile_ids.is_a?(Array)
    raise ArgumentError.new("@profile_ids must be an array.")
  elsif profile_ids.empty?
    raise ArgumentError.new("@profile_ids must contain at least one entry.")
  else
    @network_service.commit_partner_job(partnerscript_id, application_id, profile_ids, verification)
  end
end

.extra_application_data(application_id, partnerscript_id, extra_data = {}) ⇒ Object

Submit additional data about an application to Lenddo.



15
16
17
18
19
20
21
22
23
# File 'lib/lenddo/white_label_client.rb', line 15

def extra_application_data(application_id, partnerscript_id, extra_data = {})
  @network_service ||= NetworkService.new

  if extra_data.class != Hash
    raise ArgumentError.new("@extra_data must be a Hash.")
  else
    @network_service.extra_application_data(application_id, partnerscript_id, extra_data)
  end
end

.partner_token(application_id, provider, token_data, oauth_key, oauth_secret = nil) ⇒ Object

Posting network tokens, if successful, returns a “Profile ID” which is used when submitting a client for scoring.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/lenddo/white_label_client.rb', line 30

def partner_token(application_id, provider, token_data, oauth_key, oauth_secret = nil)
  @network_service ||= NetworkService.new

  if !valid_token_providers.include?(provider)
    raise ArgumentError.new("@provider must be one of the following: #{valid_token_providers.join(", ")}")
  elsif !token_data.is_a?(Hash)
    raise ArgumentError.new("@token_data must be a Hash.")
  else
    @network_service.partner_token(application_id, provider, token_data, oauth_key, oauth_secret)
  end
end