devdraft 1.0.1 → 1.0.2
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 +4 -4
- data/README.md +91 -24
- data/devdraft_ai_sdk.gemspec +3 -3
- data/example.rb +52 -17
- data/lib/devdraft/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 119e96bf6695e96bea4209911ff19c1bbbfc3eacec3a66c8c350c4f89a063dcf
|
4
|
+
data.tar.gz: 90bbf1d9ea17e0fe6ebcd1512e91000916875160eec911e14d620e378d7ff4b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6378362531af2cb84fa329fb1d3f1d6a24f7c229ddb518086d68552577c01bd3330e9a20c6c688207def2ea212a64e07d6535424f0efe6777fb3a235e761059b
|
7
|
+
data.tar.gz: 62660c3be121a8e30289438f81ea26a274ea3db69255c5c27142ea8999776e99db4b7411413f374bc3dfefc1ac434a95c395937fc8d3367d8eb7c837788c6060
|
data/README.md
CHANGED
@@ -29,8 +29,11 @@ require 'devdraft'
|
|
29
29
|
|
30
30
|
# Configure the SDK
|
31
31
|
Devdraft.configure do |config|
|
32
|
-
# Set your
|
33
|
-
config.
|
32
|
+
# Set your authentication headers (required for authenticated endpoints)
|
33
|
+
config.default_headers = {
|
34
|
+
'x-client-key' => 'YOUR_CLIENT_KEY',
|
35
|
+
'x-secret-key' => 'YOUR_SECRET_KEY'
|
36
|
+
}
|
34
37
|
|
35
38
|
# Optional: Set a custom base URL if needed
|
36
39
|
# config.base_url = 'https://api.devdraft.com'
|
@@ -40,47 +43,111 @@ Devdraft.configure do |config|
|
|
40
43
|
end
|
41
44
|
```
|
42
45
|
|
46
|
+
You can generate your client key and secret key from the [Devdraft Console](https://console.devdraft.ai) under App Settings.
|
47
|
+
|
43
48
|
### Examples
|
44
49
|
|
45
|
-
####
|
50
|
+
#### Basic Setup
|
46
51
|
```ruby
|
47
|
-
|
48
|
-
|
49
|
-
# Public health check (no auth required)
|
50
|
-
result = api_instance.health_controller_public_health_check_v0
|
51
|
-
puts result.inspect
|
52
|
+
require 'devdraft'
|
52
53
|
|
53
|
-
#
|
54
|
-
|
55
|
-
|
54
|
+
# Configure the SDK
|
55
|
+
Devdraft.configure do |config|
|
56
|
+
# Set your authentication headers (required for authenticated endpoints)
|
57
|
+
config.default_headers = {
|
58
|
+
'x-client-key' => 'YOUR_CLIENT_KEY',
|
59
|
+
'x-secret-key' => 'YOUR_SECRET_KEY'
|
60
|
+
}
|
61
|
+
|
62
|
+
# Optional: Set a custom base URL if needed
|
63
|
+
# config.base_url = 'https://api.devdraft.com'
|
64
|
+
|
65
|
+
# Optional: Enable debug logging
|
66
|
+
config.debugging = true
|
67
|
+
end
|
56
68
|
```
|
57
69
|
|
58
|
-
|
70
|
+
You can generate your client key and secret key from the [Devdraft Console](https://console.devdraft.ai) under App Settings.
|
71
|
+
|
72
|
+
#### Create a Customer
|
59
73
|
```ruby
|
60
74
|
api_instance = Devdraft::CustomersApi.new
|
61
75
|
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
|
76
|
+
# Create a new customer
|
77
|
+
customer_data = Devdraft::CreateCustomerDto.new(
|
78
|
+
email: 'customer@example.com',
|
79
|
+
name: 'John Doe',
|
80
|
+
status: 'active'
|
66
81
|
)
|
67
|
-
|
82
|
+
|
83
|
+
begin
|
84
|
+
result = api_instance.customer_controller_create(customer_data)
|
85
|
+
puts "Customer created: #{result.inspect}"
|
86
|
+
rescue Devdraft::ApiError => e
|
87
|
+
puts "Error creating customer: #{e.response_body}"
|
88
|
+
end
|
68
89
|
```
|
69
90
|
|
70
|
-
#### Create Payment Link
|
91
|
+
#### Create a Payment Link
|
71
92
|
```ruby
|
72
93
|
api_instance = Devdraft::PaymentLinksApi.new
|
73
94
|
|
74
|
-
# Create a payment link
|
95
|
+
# Create a payment link for a product
|
75
96
|
payment_link = Devdraft::CreatePaymentLinkDto.new(
|
76
|
-
amount:
|
97
|
+
amount: 99.99,
|
77
98
|
currency: 'USD',
|
78
|
-
description: '
|
79
|
-
expires_at: (Time.now +
|
99
|
+
description: 'Premium Subscription',
|
100
|
+
expires_at: (Time.now + 7.days).iso8601, # Expires in 7 days
|
101
|
+
products: [
|
102
|
+
Devdraft::PaymentLinkProductDto.new(
|
103
|
+
name: 'Premium Plan',
|
104
|
+
quantity: 1,
|
105
|
+
price: 99.99
|
106
|
+
)
|
107
|
+
]
|
80
108
|
)
|
81
109
|
|
82
|
-
|
83
|
-
|
110
|
+
begin
|
111
|
+
result = api_instance.payment_links_controller_create(payment_link)
|
112
|
+
puts "Payment link created: #{result.inspect}"
|
113
|
+
rescue Devdraft::ApiError => e
|
114
|
+
puts "Error creating payment link: #{e.response_body}"
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
#### Check Balance
|
119
|
+
```ruby
|
120
|
+
api_instance = Devdraft::AppBalancesApi.new
|
121
|
+
|
122
|
+
begin
|
123
|
+
# Get all balances
|
124
|
+
balances = api_instance.balance_controller_get_all_balances
|
125
|
+
puts "All balances: #{balances.inspect}"
|
126
|
+
|
127
|
+
# Get specific currency balance
|
128
|
+
usdc_balance = api_instance.balance_controller_get_usdc_balance
|
129
|
+
puts "USDC balance: #{usdc_balance.inspect}"
|
130
|
+
rescue Devdraft::ApiError => e
|
131
|
+
puts "Error checking balance: #{e.response_body}"
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
135
|
+
#### Create a Webhook
|
136
|
+
```ruby
|
137
|
+
api_instance = Devdraft::WebhooksApi.new
|
138
|
+
|
139
|
+
webhook = Devdraft::CreateWebhookDto.new(
|
140
|
+
url: 'https://your-domain.com/webhooks',
|
141
|
+
events: ['payment.created', 'payment.completed'],
|
142
|
+
description: 'Payment notifications'
|
143
|
+
)
|
144
|
+
|
145
|
+
begin
|
146
|
+
result = api_instance.webhook_controller_create(webhook)
|
147
|
+
puts "Webhook created: #{result.inspect}"
|
148
|
+
rescue Devdraft::ApiError => e
|
149
|
+
puts "Error creating webhook: #{e.response_body}"
|
150
|
+
end
|
84
151
|
```
|
85
152
|
|
86
153
|
### Available APIs
|
data/devdraft_ai_sdk.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.name = "devdraft"
|
19
19
|
s.version = Devdraft::VERSION
|
20
20
|
s.platform = Gem::Platform::RUBY
|
21
|
-
s.authors = ["
|
22
|
-
s.email = [""]
|
23
|
-
s.homepage = "https://github.com/
|
21
|
+
s.authors = ["Devdraft Engineer"]
|
22
|
+
s.email = ["engineering@devdraft.ai"]
|
23
|
+
s.homepage = "https://github.com/devdraftengineer/devdraft-sdk-ruby"
|
24
24
|
s.summary = "Devdraft Payment & Business Management API Ruby Gem"
|
25
25
|
s.description = " A comprehensive payment processing and business management API that enables seamless integration of cryptocurrency and traditional payment methods. "
|
26
26
|
s.license = "Unlicense"
|
data/example.rb
CHANGED
@@ -11,8 +11,11 @@ require 'devdraft'
|
|
11
11
|
|
12
12
|
# Configure the SDK
|
13
13
|
Devdraft.configure do |config|
|
14
|
-
# Set your
|
15
|
-
config.
|
14
|
+
# Set your authentication headers (required for authenticated endpoints)
|
15
|
+
config.default_headers = {
|
16
|
+
'x-client-key' => 'YOUR_CLIENT_KEY',
|
17
|
+
'x-secret-key' => 'YOUR_SECRET_KEY'
|
18
|
+
}
|
16
19
|
|
17
20
|
# Optional: Set a custom base URL if needed
|
18
21
|
# config.base_url = 'https://api.devdraft.com'
|
@@ -41,21 +44,24 @@ def check_health
|
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
44
|
-
# Example 2:
|
45
|
-
def
|
46
|
-
puts "\n===
|
47
|
+
# Example 2: Create Customer
|
48
|
+
def create_customer
|
49
|
+
puts "\n=== Create Customer Example ==="
|
47
50
|
api_instance = Devdraft::CustomersApi.new
|
48
51
|
|
49
52
|
begin
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
# Create a new customer
|
54
|
+
customer_data = Devdraft::CreateCustomerDto.new(
|
55
|
+
email: 'customer@example.com',
|
56
|
+
name: 'John Doe',
|
57
|
+
status: 'active'
|
54
58
|
)
|
55
|
-
|
59
|
+
|
60
|
+
result = api_instance.customer_controller_create(customer_data)
|
61
|
+
puts "Customer Created:"
|
56
62
|
puts result.inspect
|
57
63
|
rescue => e
|
58
|
-
puts "Error
|
64
|
+
puts "Error creating customer: #{e}"
|
59
65
|
end
|
60
66
|
end
|
61
67
|
|
@@ -67,13 +73,20 @@ def create_payment_link
|
|
67
73
|
begin
|
68
74
|
# Create a payment link
|
69
75
|
payment_link = Devdraft::CreatePaymentLinkDto.new(
|
70
|
-
amount:
|
76
|
+
amount: 99.99,
|
71
77
|
currency: 'USD',
|
72
|
-
description: '
|
73
|
-
expires_at: (Time.now +
|
78
|
+
description: 'Premium Subscription',
|
79
|
+
expires_at: (Time.now + 7.days).iso8601, # Expires in 7 days
|
80
|
+
products: [
|
81
|
+
Devdraft::PaymentLinkProductDto.new(
|
82
|
+
name: 'Premium Plan',
|
83
|
+
quantity: 1,
|
84
|
+
price: 99.99
|
85
|
+
)
|
86
|
+
]
|
74
87
|
)
|
75
88
|
|
76
|
-
result = api_instance.
|
89
|
+
result = api_instance.payment_links_controller_create(payment_link)
|
77
90
|
puts "Payment Link Created:"
|
78
91
|
puts result.inspect
|
79
92
|
rescue => e
|
@@ -81,14 +94,36 @@ def create_payment_link
|
|
81
94
|
end
|
82
95
|
end
|
83
96
|
|
97
|
+
# Example 4: Check Balance
|
98
|
+
def check_balance
|
99
|
+
puts "\n=== Check Balance Example ==="
|
100
|
+
api_instance = Devdraft::AppBalancesApi.new
|
101
|
+
|
102
|
+
begin
|
103
|
+
# Get all balances
|
104
|
+
balances = api_instance.balance_controller_get_all_balances
|
105
|
+
puts "All Balances:"
|
106
|
+
puts balances.inspect
|
107
|
+
|
108
|
+
# Get specific currency balance
|
109
|
+
usdc_balance = api_instance.balance_controller_get_usdc_balance
|
110
|
+
puts "\nUSDC Balance:"
|
111
|
+
puts usdc_balance.inspect
|
112
|
+
rescue => e
|
113
|
+
puts "Error checking balance: #{e}"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
84
117
|
# Run examples
|
85
118
|
puts "Devdraft Ruby SDK Examples"
|
86
119
|
puts "=========================="
|
87
|
-
puts "Make sure to set your
|
120
|
+
puts "Make sure to set your client key and secret key in the configuration block above."
|
121
|
+
puts "You can generate these keys from https://console.devdraft.ai under App Settings."
|
88
122
|
puts "Running examples..."
|
89
123
|
|
90
124
|
check_health
|
91
|
-
|
125
|
+
create_customer
|
92
126
|
create_payment_link
|
127
|
+
check_balance
|
93
128
|
|
94
129
|
puts "\nExamples completed!"
|
data/lib/devdraft/version.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devdraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Devdraft Engineer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -74,7 +74,7 @@ description: " A comprehensive payment processing and business management API th
|
|
74
74
|
enables seamless integration of cryptocurrency and traditional payment methods.
|
75
75
|
\ "
|
76
76
|
email:
|
77
|
-
-
|
77
|
+
- engineering@devdraft.ai
|
78
78
|
executables: []
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
@@ -283,7 +283,7 @@ files:
|
|
283
283
|
- spec/models/update_webhook_dto_spec.rb
|
284
284
|
- spec/models/webhook_response_dto_spec.rb
|
285
285
|
- spec/spec_helper.rb
|
286
|
-
homepage: https://github.com/
|
286
|
+
homepage: https://github.com/devdraftengineer/devdraft-sdk-ruby
|
287
287
|
licenses:
|
288
288
|
- Unlicense
|
289
289
|
metadata: {}
|