Friendlyscore 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/friendlyscore.rb +113 -0
- data/lib/friendlyscore/cloud.rb +25 -0
- data/lib/friendlyscore/whitelabel.rb +50 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 292ef70fc10293b52cd2a3fc17b3379a7fd25f66
|
4
|
+
data.tar.gz: f18fbe8c5bda99a0b9a5c573feaa30fef3a5803b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a59978092f2e5dc147b84f9123646b4d6001126aa89ea0a307cc040685d22dc6ea05f3fb03cc783249c1227faf5d2be7ed3939eb4ed83df46c8387f2be4635a7
|
7
|
+
data.tar.gz: 53e1c6e84d6c03de6957e11fff8dbe27d93d8c0f82c82d6490a16974e35aa9647af2d977b723bd408a2f1f8ffb90a7c2978fa13a6291e927ae1df9904e8f3eac
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# gem install oauth2
|
2
|
+
require 'oauth2'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Friendlyscore
|
6
|
+
|
7
|
+
class Friendlyscore
|
8
|
+
|
9
|
+
attr_accessor :client_id, :client_secret, :base_url
|
10
|
+
attr_reader :client
|
11
|
+
|
12
|
+
def initialize(cid,sec)
|
13
|
+
@by = nil
|
14
|
+
@id = nil
|
15
|
+
@client_id = cid
|
16
|
+
@client_secret = sec
|
17
|
+
end
|
18
|
+
|
19
|
+
def connect
|
20
|
+
@client = OAuth2::Client.new(
|
21
|
+
@client_id,
|
22
|
+
@client_secret,
|
23
|
+
{
|
24
|
+
:site => @base_url,
|
25
|
+
:token_url => '/oauth/v2/token'
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def token
|
31
|
+
connect if @client.nil?
|
32
|
+
client.client_credentials.get_token
|
33
|
+
end
|
34
|
+
|
35
|
+
def users(page=1, max_results=20)
|
36
|
+
token.get '/api/v2/users.json', :params => { 'page' => page, 'max_results' => max_results }
|
37
|
+
end
|
38
|
+
|
39
|
+
def by_id(id)
|
40
|
+
@by = 'id'
|
41
|
+
@id = id
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
def by_partner_id(id)
|
46
|
+
@by = 'partner-id'
|
47
|
+
@id = id
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def calculate_score(params)
|
52
|
+
token.post "/api/v2/users/#{@by}/#{@id}/calculate_score.json", :body => params
|
53
|
+
end
|
54
|
+
|
55
|
+
def user
|
56
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show.json"
|
57
|
+
end
|
58
|
+
|
59
|
+
def google_places_data
|
60
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/places.json"
|
61
|
+
end
|
62
|
+
|
63
|
+
def google_dob_data
|
64
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/days-of-birth.json"
|
65
|
+
end
|
66
|
+
|
67
|
+
def google_skills_data
|
68
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/skills.json"
|
69
|
+
end
|
70
|
+
|
71
|
+
def google_phones_data
|
72
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/phones.json"
|
73
|
+
end
|
74
|
+
|
75
|
+
def google_work_periods_data
|
76
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/work-periods.json"
|
77
|
+
end
|
78
|
+
|
79
|
+
def google_universities_data
|
80
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/universities.json"
|
81
|
+
end
|
82
|
+
|
83
|
+
def google_emails_data
|
84
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google/raw-file-data/emails.json"
|
85
|
+
end
|
86
|
+
|
87
|
+
def user_ip_address_data
|
88
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show/ip-address-data.json"
|
89
|
+
end
|
90
|
+
|
91
|
+
def user_min_fraud_data
|
92
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show/min-fraud-data.json"
|
93
|
+
end
|
94
|
+
|
95
|
+
def add_user_performance_data(params)
|
96
|
+
token.post "/api/v2/users/#{@by}/#{@id}/performance-data.json", :body => params
|
97
|
+
end
|
98
|
+
|
99
|
+
def set_positive(val)
|
100
|
+
token.put "/api/v2/users/#{@by}/#{@id}/positive/#{val ? '1' : '0'}.json"
|
101
|
+
end
|
102
|
+
|
103
|
+
def set_status(status, description)
|
104
|
+
params = {
|
105
|
+
'status' => status,
|
106
|
+
'description' => description
|
107
|
+
}
|
108
|
+
token.post "/api/v2/users/#{@by}/#{@id}/status.json", :body => params
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'friendlyscore'
|
2
|
+
|
3
|
+
module Friendlyscore
|
4
|
+
|
5
|
+
class Cloud < Friendlyscore
|
6
|
+
|
7
|
+
def user_social_network_data
|
8
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show/social-network-data.json"
|
9
|
+
end
|
10
|
+
|
11
|
+
def user_data_points
|
12
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show/data-points.json"
|
13
|
+
end
|
14
|
+
|
15
|
+
def user_heat_map_coordinates
|
16
|
+
token.get "/api/v2/users/#{@by}/#{@id}/show/heat-map-coordinates.json"
|
17
|
+
end
|
18
|
+
|
19
|
+
def fraud_alerts
|
20
|
+
token.get "/api/v2/fraudalerts/#{@by}/#{@id}/show.json"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'friendlyscore'
|
2
|
+
|
3
|
+
module Friendlyscore
|
4
|
+
|
5
|
+
class WhiteLabel < Friendlyscore
|
6
|
+
|
7
|
+
def initialize(url, cid, sec)
|
8
|
+
@by = nil
|
9
|
+
@id = nil
|
10
|
+
@client_id = cid
|
11
|
+
@client_secret = sec
|
12
|
+
@base_url = url
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_score(partner_user_id=nil)
|
16
|
+
if partner_user_id.nil? and @by == 'partner-id'
|
17
|
+
partner_user_id = @id
|
18
|
+
end
|
19
|
+
|
20
|
+
raise ArgumentError, 'Either argument partner_user_id must be passed or by_partner_id() method must be called before get_score' if partner_user_id.nil?
|
21
|
+
token.get '/api/v2/get_score.json', :params => { 'partner_user_id' => partner_user_id }
|
22
|
+
end
|
23
|
+
|
24
|
+
def user_facebook_data
|
25
|
+
token.get "/api/v2/users/#{@by}/#{@id}/facebook-data.json"
|
26
|
+
end
|
27
|
+
|
28
|
+
def user_linkedin_data
|
29
|
+
token.get "/api/v2/users/#{@by}/#{@id}/linkedin-data.json"
|
30
|
+
end
|
31
|
+
|
32
|
+
def user_twitter_data
|
33
|
+
token.get "/api/v2/users/#{@by}/#{@id}/twitter-data.json"
|
34
|
+
end
|
35
|
+
|
36
|
+
def user_google_data
|
37
|
+
token.get "/api/v2/users/#{@by}/#{@id}/google-data.json"
|
38
|
+
end
|
39
|
+
|
40
|
+
def user_paypal_data
|
41
|
+
token.get "/api/v2/users/#{@by}/#{@id}/paypal-data.json"
|
42
|
+
end
|
43
|
+
|
44
|
+
def user_instagram_data
|
45
|
+
token.get "/api/v2/users/#{@by}/#{@id}/instagram-data.json"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Friendlyscore
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rafał Toboła
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.4.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.4'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.4.0
|
33
|
+
description: Friendlyscore Cloud and Whitelabel API's ruby client
|
34
|
+
email: r.tobola@friendlyscore.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- lib/friendlyscore.rb
|
40
|
+
- lib/friendlyscore/cloud.rb
|
41
|
+
- lib/friendlyscore/whitelabel.rb
|
42
|
+
homepage: http://rubygems.org/gems/friendlyscore
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.6.13
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Friendlyscore OAuth2 API client.
|
66
|
+
test_files: []
|