udene_sdk 1.0.0 → 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
  SHA256:
3
- metadata.gz: 7d4e2ca9ac497e9c534df7c0a11089805bf3b67b0763443b76794a2facd55898
4
- data.tar.gz: 86dfe83c6d25f7452a1795cd2a8ec6da567f1c675458f8373abd3d1f310bd0aa
3
+ metadata.gz: 2f7161868e74f1770b7a9a19fdd399ccd22d6e89465217e9330edd3c287a47e1
4
+ data.tar.gz: 3be543177d7c7d3a866f04a3130ef50c969af7df102e31cff7dbc447a1d310f5
5
5
  SHA512:
6
- metadata.gz: 55493d3ee512f04e96eed901f3aabe79fcac5b3c476c332342b4e1aa4e0f7d7937114a7d7525695bd502ef4caaad9f44cbff8b3564f61cdab54aeefdd71e7f91
7
- data.tar.gz: 1ab024a9cccc527628de7bc1608ac5ddc0e9a9616aacf957142cca84f44ba2bdec219d8d85e89634ad641a11f1db15e8e52d88beec8630f71d1b120afb02e3d0
6
+ metadata.gz: fd2338b0048d8fc102ececb29d70d2ef85896382e2eb657df004452c0a9aa9595ae946188affd40f89efd607ff5fd32b53ba1ce63c2c1052a7d4551f72e49276
7
+ data.tar.gz: 9c2a7ee6fa264f98d486d30eed9e06adf5125f124b9ee39d9d74e58df4444e47d7ae9952ee936f9e530ad06c5a6df3bec8269fe94633b0a55e92d78fe2841acb
data/README.md CHANGED
@@ -1,3 +1,126 @@
1
1
  # Udene Ruby SDK
2
2
 
3
- A Ruby SDK for interacting with the Udene API.
3
+ A Ruby SDK for interacting with the Udene Fraud Detection API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'udene_sdk'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ $ bundle install
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ $ gem install udene_sdk
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Initialization
28
+
29
+ ```ruby
30
+ require 'udene_sdk'
31
+
32
+ # Initialize with API key
33
+ client = UdeneSDK::Client.new('your_api_key')
34
+
35
+ # Or set API key globally
36
+ UdeneSDK.api_key = 'your_api_key'
37
+ client = UdeneSDK::Client.new
38
+ ```
39
+
40
+ ### Get Metrics
41
+
42
+ ```ruby
43
+ metrics = client.get_metrics
44
+ puts metrics.fraud_rate
45
+ ```
46
+
47
+ ### Get Activity
48
+
49
+ ```ruby
50
+ activity = client.get_activity
51
+ puts activity.total_transactions
52
+ ```
53
+
54
+ ### Track Interaction
55
+
56
+ ```ruby
57
+ response = client.track_interaction({
58
+ userId: 'user123',
59
+ action: 'login',
60
+ metadata: {
61
+ ip: '192.168.1.1',
62
+ device: 'mobile'
63
+ }
64
+ })
65
+ ```
66
+
67
+ ### Analyze Transaction
68
+
69
+ ```ruby
70
+ result = client.analyze_transaction({
71
+ amount: 100.00,
72
+ currency: 'USD',
73
+ userId: 'user123',
74
+ paymentMethod: 'credit_card'
75
+ })
76
+
77
+ if result.risk_score > 80
78
+ puts "High risk transaction detected!"
79
+ end
80
+ ```
81
+
82
+ ### Get Device Fingerprint
83
+
84
+ ```ruby
85
+ fingerprint = client.get_device_fingerprint
86
+ puts fingerprint.device_id
87
+ ```
88
+
89
+ ### Analyze Business Email Compromise
90
+
91
+ ```ruby
92
+ result = client.analyze_bec({
93
+ sender: 'ceo@company.com',
94
+ recipient: 'finance@company.com',
95
+ subject: 'Urgent wire transfer',
96
+ body: 'Please wire $10,000 to the following account...'
97
+ })
98
+
99
+ if result.is_suspicious
100
+ puts "Potential BEC attack detected!"
101
+ end
102
+ ```
103
+
104
+ ## Error Handling
105
+
106
+ ```ruby
107
+ begin
108
+ result = client.analyze_transaction(transaction_data)
109
+ rescue UdeneSDK::RateLimitError => e
110
+ puts "Rate limit exceeded. Retry after #{e.retry_after} seconds."
111
+ rescue UdeneSDK::ClientError => e
112
+ puts "Client error: #{e.message}, Status: #{e.status_code}"
113
+ rescue UdeneSDK::ServerError => e
114
+ puts "Server error: #{e.message}, Status: #{e.status_code}"
115
+ rescue UdeneSDK::APIError => e
116
+ puts "API error: #{e.message}"
117
+ end
118
+ ```
119
+
120
+ ## Development
121
+
122
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
123
+
124
+ ## License
125
+
126
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -9,7 +9,7 @@ module UdeneSDK
9
9
  class Client
10
10
  attr_reader :api_key, :base_url
11
11
 
12
- def initialize(api_key = nil, base_url = "https://udene.net/v1")
12
+ def initialize(api_key = nil, base_url = "https://api.udene.com/v1")
13
13
  @api_key = api_key || UdeneSDK.api_key
14
14
  @base_url = base_url
15
15
 
@@ -42,6 +42,18 @@ module UdeneSDK
42
42
  handle_response(response)
43
43
  end
44
44
 
45
+ def get_device_fingerprint
46
+ response = @connection.get("device-fingerprint")
47
+ handle_response(response)
48
+ end
49
+
50
+ def analyze_bec(email_data)
51
+ response = @connection.post("analyze/bec") do |req|
52
+ req.body = email_data
53
+ end
54
+ handle_response(response)
55
+ end
56
+
45
57
  private
46
58
 
47
59
  def build_connection
@@ -51,6 +63,7 @@ module UdeneSDK
51
63
  conn.headers = {
52
64
  "Authorization" => "Bearer #{@api_key}",
53
65
  "Content-Type" => "application/json",
66
+ "User-Agent" => "UdeneSDK/#{UdeneSDK::VERSION} Ruby/#{RUBY_VERSION}",
54
67
  "X-Client-Version" => UdeneSDK::VERSION,
55
68
  "X-SDK-Type" => "ruby"
56
69
  }
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module UdeneSDK
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: udene_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udene Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday