nextcaller_client 0.0.3 → 0.0.4

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -14
  3. data/examples/client_get_by_address_name.rb +127 -0
  4. data/examples/client_get_by_email.rb +57 -0
  5. data/examples/client_get_by_phone.rb +4 -5
  6. data/examples/client_get_by_profile_id.rb +4 -3
  7. data/examples/client_get_fraud_level.rb +13 -7
  8. data/examples/client_update_by_profile_id.rb +3 -6
  9. data/examples/platform_get_by_address_name.rb +127 -0
  10. data/examples/platform_get_by_email.rb +57 -0
  11. data/examples/platform_get_by_phone.rb +5 -5
  12. data/examples/platform_get_by_profile_id.rb +5 -5
  13. data/examples/platform_get_fraud_level.rb +5 -5
  14. data/examples/platform_get_statistics.rb +4 -4
  15. data/examples/platform_get_user.rb +5 -5
  16. data/examples/platform_update_by_profile_id.rb +5 -5
  17. data/examples/platform_update_platform_user.rb +5 -5
  18. data/lib/nextcaller_client/client.rb +127 -77
  19. data/lib/nextcaller_client/constants.rb +9 -3
  20. data/lib/nextcaller_client/exceptions.rb +10 -0
  21. data/lib/nextcaller_client/transport.rb +6 -6
  22. data/lib/nextcaller_client/utils.rb +4 -24
  23. data/lib/nextcaller_client/version.rb +1 -1
  24. data/test/constants.rb +1 -1
  25. data/test/test_by_address_name.rb +27 -0
  26. data/test/test_by_phone.rb +0 -12
  27. data/test/test_by_profile.rb +0 -12
  28. data/test/test_fraud_level.rb +1 -7
  29. data/test/test_platform_by_address_name.rb +29 -0
  30. data/test/test_platform_by_phone.rb +2 -14
  31. data/test/test_platform_by_profile_id.rb +3 -27
  32. data/test/test_platform_fraud_level.rb +2 -14
  33. data/test/test_platform_statistics.rb +2 -2
  34. data/test/test_platform_user.rb +5 -17
  35. metadata +11 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dad21050c4c7b20a11909629c5ac046c510e01f
4
- data.tar.gz: e3d576fc8338e4e4ead88b24ba6b048c186d5f24
3
+ metadata.gz: 81106706a54902bfaa5b02fe44a008b2aa51ec77
4
+ data.tar.gz: ac38872c66caa64f1e0d52c256f77758ae3d0385
5
5
  SHA512:
6
- metadata.gz: ee989ed5e9e42a07fabf5d6b4337d864e93a54d16efd3a0da4d833707907c7cdaafda820a606d894e449ffad1fa7344ae600144318b15dd46602b883cb995036
7
- data.tar.gz: 85cb16a130a0d5084d43e4cc5c42e63df321bd2003d3f336f5626a4cbf63442bd98b67b1b5a328ae5e6241923ef22ca6577caa8f60bd26cb3da865ec36e8ff5f
6
+ metadata.gz: 6de84aa4b05b65507fd8c76a7ccd5272d1e7a73e1d70d6e63dce6d5f62b1c05c2bb70028f6126c1864909054b7e49f8a24369e1a360ff65e14978eb6f8f5a9bc
7
+ data.tar.gz: 3e08e22402d8223e3adc2863f7951ee009c678ef884d0a04d5f9d35e80128eb4cc9903388b534bb79d14225efece3a202164c3d6deeadf52155d27a394720d5c
data/README.md CHANGED
@@ -25,54 +25,54 @@ Or install it yourself as:
25
25
  **Example**
26
26
 
27
27
  require 'nextcaller_client'
28
- username = "XXXXX"
29
- password = "YYYYY"
28
+ api_username = "XXXXX"
29
+ api_password = "YYYYY"
30
30
  phone_number = "121212..."
31
- client = NextcallerClient::NextCallerClient.new(username, password)
31
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password)
32
32
  resp = client.get_by_phone(phone_number)
33
33
  print resp
34
34
 
35
35
  **Initializing client**
36
36
 
37
37
  require 'nextcaller_client'
38
- username = "XXXXX"
39
- password = "YYYYY"
40
- client = NextcallerClient::NextCallerClient.new(username, password)
38
+ api_username = "XXXXX"
39
+ api_password = "YYYYY"
40
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password)
41
41
 
42
42
  **Get profile by phone**
43
43
 
44
- resp = client.get_by_phone(phone, debug)
44
+ resp = client.get_by_phone(phone)
45
45
 
46
46
  # arguments:
47
47
  # phone -- 10 digits phone, str or int, required
48
- # debug -- boolean (default false)
48
+
49
49
 
50
50
  **Get profile by id**
51
51
 
52
- resp = client.get_by_profile_id(profile_id, debug)
52
+ resp = client.get_by_profile_id(profile_id)
53
53
 
54
54
  # arguments:
55
55
  # profile_id -- Profile identifier, required
56
- # debug -- boolean (default false)
56
+
57
57
 
58
58
  **Update profile by id**
59
59
 
60
- resp = client.update_by_profile_id(profile_id, data, debug)
60
+ resp = client.update_by_profile_id(profile_id, data)
61
61
 
62
62
  # arguments:
63
63
  # profile_id -- Profile identifier, required
64
64
  # data -- dictionary with changed data, required
65
- # debug -- boolean (default false)
65
+
66
66
 
67
67
  # Returns 204 response in the case of the succesfull request.
68
68
 
69
69
  **Get fraud level**
70
70
 
71
- resp = client.get_fraud_level(phone, debug)
71
+ resp = client.get_fraud_level(phone)
72
72
 
73
73
  # arguments:
74
74
  # phone -- 10 digits phone, str or int, required
75
- # debug -- boolean (default false)
75
+
76
76
 
77
77
 
78
78
  ##Errors handling
@@ -0,0 +1,127 @@
1
+ require 'nextcaller_client'
2
+
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
+ sandbox = false
6
+ address_data = {
7
+ 'first_name' => 'Jerry',
8
+ 'last_name' => 'Seinfeld',
9
+ 'address' => '129 West 81st Street',
10
+ 'city' => 'New York',
11
+ 'state' => 'NY',
12
+ 'zip_code' => '10024'
13
+ }
14
+
15
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
16
+
17
+ begin
18
+ response_content = client.get_by_name_address(address_data)
19
+ puts response_content.class # Response is a hash
20
+ puts "First name: " + response_content['records'][0]['first_name'] # Retrieve first name for example
21
+ puts response_content
22
+ rescue ArgumentError => error
23
+ puts error.message
24
+ rescue NextcallerClient::HttpException => error
25
+ puts error.message
26
+ puts error.content
27
+ end
28
+
29
+ #Hash
30
+ # First name: Jerry
31
+ # {
32
+ # "records" => [
33
+ # {
34
+ # "id" => "97d949a413f4ea8b85e9586e1f2d9a",
35
+ # "first_name" => "Jerry",
36
+ # "first_pronounced" => "JER-ee",
37
+ # "middle_name" => "Allen",
38
+ # "last_name" => "Seinfeld",
39
+ # "name" => "Jerry Allen Seinfeld",
40
+ # "language" => "English",
41
+ # "phone" => [
42
+ # {
43
+ # "number" => "2125558383",
44
+ # "resource_uri" => "/v2/records/2125558383/"
45
+ # }
46
+ # ],
47
+ # "address" => [
48
+ # {
49
+ # "city" => "New York",
50
+ # "extended_zip" => "2344",
51
+ # "country" => "USA",
52
+ # "line1" => "129 West 81st Street",
53
+ # "line2" => "Apt 5A",
54
+ # "state" => "NY",
55
+ # "zip_code" => "10024"
56
+ # },
57
+ # {
58
+ # "city" => "New York",
59
+ # "extended_zip" => "2345",
60
+ # "country" => "USA",
61
+ # "line1" => "129 West 81st Street",
62
+ # "line2" => "Apt 5B",
63
+ # "state" => "NY",
64
+ # "zip_code" => "10024"
65
+ # }
66
+ # ],
67
+ # "relatives" => [
68
+ # {
69
+ # "id" => "30400c6a0567b3a5168c9812ed617c",
70
+ # "name" => "Morty Seinfeld",
71
+ # "resource_uri" => "/v2/users/30400c6a0567b3a5168c9812ed617c/"
72
+ # },
73
+ # {
74
+ # "id" => "6d342b76b2b9b00c63324a0d0fcca8",
75
+ # "name" => "Helen Seinfeld",
76
+ # "resource_uri" => "/v2/users/6d342b76b2b9b00c63324a0d0fcca8/"
77
+ # }
78
+ # ],
79
+ # "email" => "jerry@example.org",
80
+ # "line_type" => "Mobile",
81
+ # "carrier" => "Verizon Wireless",
82
+ # "linked_emails" => [
83
+ # "jerry@example.org",
84
+ # "badman@example.org",
85
+ # "domainmaster@example.org",
86
+ # "hellooooooo@example.org",
87
+ # "jaseinfeld@example.org",
88
+ # "jerry_seinfeld@example.org",
89
+ # "puffyshirt@example.org",
90
+ # "seinfeld4@example.org"
91
+ # ],
92
+ # "social_links" => [
93
+ # {
94
+ # "type" => "twitter",
95
+ # "url" => "https://twitter.com/jerryseinfeld",
96
+ # "followers" => 26700
97
+ # },
98
+ # {
99
+ # "type" => "facebook",
100
+ # "url" => "https://www.facebook.com/JerrySeinfeld",
101
+ # "followers" => 6584
102
+ # },
103
+ # {
104
+ # "type" => "linkedin",
105
+ # "url" => "https://www.linkedin.com/pub/jerry-seinfeld"
106
+ # }
107
+ # ],
108
+ # "age" => "45-54",
109
+ # "education" => "Completed College",
110
+ # "gender" => "Male",
111
+ # "high_net_worth" => "Yes",
112
+ # "home_owner_status" => "Rent",
113
+ # "household_income" => "50k-75k",
114
+ # "length_of_residence" => "10 Years",
115
+ # "marital_status" => "Single",
116
+ # "market_value" => "500k-1mm",
117
+ # "occupation" => "White Collar Worker",
118
+ # "presence_of_children" => "No",
119
+ # "department" => "not specified",
120
+ # "telco_zip" => "0",
121
+ # "telco_zip_4" => "",
122
+ # "resource_uri" => "/v2/users/97d949a413f4ea8b85e9586e1f2d9a/"
123
+ # }
124
+ # ]
125
+ # }
126
+ #
127
+ #
@@ -0,0 +1,57 @@
1
+ require 'nextcaller_client'
2
+
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
+ sandbox = false
6
+ email = 'email@exmaple.com'
7
+
8
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
9
+
10
+ begin
11
+ response_content = client.get_by_email(email)
12
+ puts response_content.class # Response is a hash
13
+ puts "First name: " + response_content['records'][0]['first_name'] # Retrieve first name for example
14
+ puts response_content
15
+ rescue ArgumentError => error
16
+ puts error.message
17
+ rescue NextcallerClient::HttpException => error
18
+ puts error.message
19
+ puts error.content
20
+ end
21
+
22
+ # Output:
23
+ # Hash
24
+ # First name: Jerry
25
+ # {
26
+ # "records"=>[
27
+ # {
28
+ # "id"=>"97d949a413f4ea8b85e9586e1f2d9a",
29
+ # "first_name"=>"Jerry",
30
+ # "middle_name"=>"",
31
+ # "last_name"=>"Seinfeld",
32
+ # "name"=>"Jerry Seinfeld",
33
+ # "language"=>"English",
34
+ # "phone"=>[
35
+ # {
36
+ # "number"=>"2125558383",
37
+ # "resource_uri"=>"/v2/records/2125558383/"
38
+ # }
39
+ # ],
40
+ # "carrier"=>"Verizon Wireless",
41
+ # "address"=>[
42
+ # {
43
+ # "city"=>"New York",
44
+ # "extended_zip"=>"",
45
+ # "country"=>"USA",
46
+ # "line1"=>"129 West 81st Street",
47
+ # "line2"=>"Apt 5a",
48
+ # "state"=>"NY",
49
+ # "zip_code"=>"10024"
50
+ # }
51
+ # ],
52
+ # "line_type"=>"",
53
+ # "department"=>"not specified",
54
+ # "resource_uri"=>"/v2/users/97d949a413f4ea8b85e9586e1f2d9a/"
55
+ # }
56
+ # ]
57
+ # }
@@ -1,12 +1,11 @@
1
1
  require 'nextcaller_client'
2
2
 
3
- username = 'E72D42B98D2232703EE3'
4
- password = '826f22ade660d6612523b212b997094c70dba8e1'
5
-
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
6
5
  sandbox = false
7
6
  phone_number = '2125558383'
8
7
 
9
- client = NextcallerClient::NextCallerClient.new(username, password, sandbox)
8
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
10
9
 
11
10
  begin
12
11
  response_content = client.get_by_phone(phone_number)
@@ -68,4 +67,4 @@ end
68
67
  # "resource_uri": "/v2/users/97d949a413f4ea8b85e9586e1f2d9a/"
69
68
  # }
70
69
  # ]
71
- # }
70
+ # }
@@ -1,11 +1,11 @@
1
1
  require 'nextcaller_client'
2
2
 
3
- username = 'XXXXX'
4
- password = 'XXXXX'
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
5
  sandbox = false
6
6
  profile_id = '97d949a413f4ea8b85e9586e1f2d9a'
7
7
 
8
- client = NextcallerClient::NextCallerClient.new(username, password, sandbox)
8
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
9
9
 
10
10
  begin
11
11
  response_content = client.get_by_profile_id(profile_id)
@@ -18,6 +18,7 @@ rescue NextcallerClient::HttpException => error
18
18
  puts error.message
19
19
  puts error.content
20
20
  end
21
+
21
22
  # Output:
22
23
  # Hash
23
24
  # First name: Jerry
@@ -1,11 +1,11 @@
1
1
  require 'nextcaller_client'
2
2
 
3
- username = 'XXXXX'
4
- password = 'XXXXX'
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
5
  sandbox = false
6
6
  phone_number = '2125558383'
7
7
 
8
- client = NextcallerClient::NextCallerClient.new(username, password, sandbox)
8
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
9
9
 
10
10
  begin
11
11
  response_content = client.get_fraud_level(phone_number)
@@ -18,10 +18,16 @@ rescue NextcallerClient::HttpException => error
18
18
  puts error.message
19
19
  puts error.content
20
20
  end
21
+
21
22
  # Output:
22
23
  # Hash
23
24
  # Fraud risk: medium
24
- # {
25
- # "fraud_risk"=>"medium",
26
- # "spoofed"=>"unknown"
27
- # }
25
+ # {
26
+ # "created"=>1439237857,
27
+ # "created_iso"=>"2015-08-10T16:17:37.560719+00:00",
28
+ # "spoofed"=>"unknown",
29
+ # "ani"=>"12125558383",
30
+ # "fraud_risk"=>"medium",
31
+ # "cid"=>"unknown",
32
+ # "cid_blocked"=>"no"
33
+ # }
@@ -1,20 +1,17 @@
1
1
  require 'nextcaller_client'
2
2
 
3
- username = 'XXXXX'
4
- password = 'XXXXX'
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
5
  sandbox = false
6
6
  profile_id = '97d949a413f4ea8b85e9586e1f2d9a'
7
7
 
8
- client = NextcallerClient::NextCallerClient.new(username, password, sandbox)
8
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
9
9
 
10
10
  begin
11
11
  data = {
12
12
  first_name: "Clark",
13
13
  last_name:"Kent",
14
14
  email:"clarkkent@supermail.com",
15
- phone1:"1234567890",
16
- phone2:"2345678901",
17
- phone3:"3456789012",
18
15
  shipping_address1:{
19
16
  line1:"223 Kryptonite Ave.",
20
17
  line2:"",
@@ -0,0 +1,127 @@
1
+ require 'nextcaller_client'
2
+
3
+ api_username = 'XXXXX'
4
+ api_password = 'XXXXX'
5
+ sandbox = false
6
+ address_data = {
7
+ 'first_name' => 'Jerry',
8
+ 'last_name' => 'Seinfeld',
9
+ 'address' => '129 West 81st Street',
10
+ 'city' => 'New York',
11
+ 'state' => 'NY',
12
+ 'zip_code' => '10024'
13
+ }
14
+
15
+ client = NextcallerClient::NextCallerClient.new(api_username, api_password, sandbox)
16
+
17
+ begin
18
+ response_content = client.get_by_name_address(address_data)
19
+ puts response_content.class # Response is a hash
20
+ puts "First name: " + response_content['records'][0]['first_name'] # Retrieve first name for example
21
+ puts response_content
22
+ rescue ArgumentError => error
23
+ puts error.message
24
+ rescue NextcallerClient::HttpException => error
25
+ puts error.message
26
+ puts error.content
27
+ end
28
+ # Output:
29
+ # Hash
30
+ # First name: Jerry
31
+ # {
32
+ # "records" => [
33
+ # {
34
+ # "id" => "97d949a413f4ea8b85e9586e1f2d9a",
35
+ # "first_name" => "Jerry",
36
+ # "first_pronounced" => "JER-ee",
37
+ # "middle_name" => "Allen",
38
+ # "last_name" => "Seinfeld",
39
+ # "name" => "Jerry Allen Seinfeld",
40
+ # "language" => "English",
41
+ # "phone" => [
42
+ # {
43
+ # "number" => "2125558383",
44
+ # "resource_uri" => "/v2/records/2125558383/"
45
+ # }
46
+ # ],
47
+ # "address" => [
48
+ # {
49
+ # "city" => "New York",
50
+ # "extended_zip" => "2344",
51
+ # "country" => "USA",
52
+ # "line1" => "129 West 81st Street",
53
+ # "line2" => "Apt 5A",
54
+ # "state" => "NY",
55
+ # "zip_code" => "10024"
56
+ # },
57
+ # {
58
+ # "city" => "New York",
59
+ # "extended_zip" => "2345",
60
+ # "country" => "USA",
61
+ # "line1" => "129 West 81st Street",
62
+ # "line2" => "Apt 5B",
63
+ # "state" => "NY",
64
+ # "zip_code" => "10024"
65
+ # }
66
+ # ],
67
+ # "relatives" => [
68
+ # {
69
+ # "id" => "30400c6a0567b3a5168c9812ed617c",
70
+ # "name" => "Morty Seinfeld",
71
+ # "resource_uri" => "/v2/users/30400c6a0567b3a5168c9812ed617c/"
72
+ # },
73
+ # {
74
+ # "id" => "6d342b76b2b9b00c63324a0d0fcca8",
75
+ # "name" => "Helen Seinfeld",
76
+ # "resource_uri" => "/v2/users/6d342b76b2b9b00c63324a0d0fcca8/"
77
+ # }
78
+ # ],
79
+ # "email" => "jerry@example.org",
80
+ # "line_type" => "Mobile",
81
+ # "carrier" => "Verizon Wireless",
82
+ # "linked_emails" => [
83
+ # "jerry@example.org",
84
+ # "badman@example.org",
85
+ # "domainmaster@example.org",
86
+ # "hellooooooo@example.org",
87
+ # "jaseinfeld@example.org",
88
+ # "jerry_seinfeld@example.org",
89
+ # "puffyshirt@example.org",
90
+ # "seinfeld4@example.org"
91
+ # ],
92
+ # "social_links" => [
93
+ # {
94
+ # "type" => "twitter",
95
+ # "url" => "https://twitter.com/jerryseinfeld",
96
+ # "followers" => 26700
97
+ # },
98
+ # {
99
+ # "type" => "facebook",
100
+ # "url" => "https://www.facebook.com/JerrySeinfeld",
101
+ # "followers" => 6584
102
+ # },
103
+ # {
104
+ # "type" => "linkedin",
105
+ # "url" => "https://www.linkedin.com/pub/jerry-seinfeld"
106
+ # }
107
+ # ],
108
+ # "age" => "45-54",
109
+ # "education" => "Completed College",
110
+ # "gender" => "Male",
111
+ # "high_net_worth" => "Yes",
112
+ # "home_owner_status" => "Rent",
113
+ # "household_income" => "50k-75k",
114
+ # "length_of_residence" => "10 Years",
115
+ # "marital_status" => "Single",
116
+ # "market_value" => "500k-1mm",
117
+ # "occupation" => "White Collar Worker",
118
+ # "presence_of_children" => "No",
119
+ # "department" => "not specified",
120
+ # "telco_zip" => "0",
121
+ # "telco_zip_4" => "",
122
+ # "resource_uri" => "/v2/users/97d949a413f4ea8b85e9586e1f2d9a/"
123
+ # }
124
+ # ]
125
+ # }
126
+ #
127
+ #