paid_ruby 0.1.1.pre.rc2 → 0.1.1.pre.rc5
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/lib/gemconfig.rb +1 -0
- data/lib/paid_ruby/agents/client.rb +20 -10
- data/lib/paid_ruby/contacts/client.rb +10 -16
- data/lib/paid_ruby/customers/client.rb +4 -4
- data/lib/paid_ruby/orders/client.rb +14 -12
- data/lib/paid_ruby/orders/lines/client.rb +2 -2
- data/lib/paid_ruby/types/billing_frequency.rb +3 -3
- data/lib/paid_ruby/types/pricing.rb +9 -2
- data/lib/paid_ruby/types/pricing_model_type.rb +1 -0
- data/lib/paid_ruby/types/signal.rb +9 -2
- data/lib/paid_ruby/usage/client.rb +4 -2
- data/lib/requests.rb +2 -2
- metadata +59 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f5fd3f258651c6fcbc104ccb8f04ad0ed5ed46062542cdfb78e256b852a6050
|
4
|
+
data.tar.gz: fddebf19044b8972da342ff75de44a477de184e83ed245d059cd15eb57990edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d02d7883423a408e7e1ac4ce2b696aa2b3b505e53c4240ee91bf3d2ebaf9689c20af937f295db9e596b026a35fa63ebcd8a31786f91bfc3245726ec360cc7248
|
7
|
+
data.tar.gz: ca0acbe775e1647c6b204aa2c64e90bd0a082106b48f6dc39fba291d8d6fc39037dc413821c29935fac5c8af1f8bb02d6420993b61a99a84dcb9d1c42e56323c
|
data/lib/gemconfig.rb
CHANGED
@@ -60,6 +60,7 @@ end
|
|
60
60
|
# @param description [String]
|
61
61
|
# @param agent_code [String]
|
62
62
|
# @param external_id [String]
|
63
|
+
# @param active [Boolean]
|
63
64
|
# @param request_options [Paid::RequestOptions]
|
64
65
|
# @return [Paid::Agent]
|
65
66
|
# @example
|
@@ -68,8 +69,12 @@ end
|
|
68
69
|
# environment: Paid::Environment::PRODUCTION,
|
69
70
|
# token: "YOUR_AUTH_TOKEN"
|
70
71
|
# )
|
71
|
-
# api.agents.create(
|
72
|
-
|
72
|
+
# api.agents.create(
|
73
|
+
# name: "Acme Agent",
|
74
|
+
# description: "Acme Agent is an AI agent that does things.",
|
75
|
+
# external_id: "acme-agent"
|
76
|
+
# )
|
77
|
+
def create(name:, description:, agent_code: nil, external_id: nil, active: nil, request_options: nil)
|
73
78
|
response = @request_client.conn.post do | req |
|
74
79
|
unless request_options&.timeout_in_seconds.nil?
|
75
80
|
req.options.timeout = request_options.timeout_in_seconds
|
@@ -81,7 +86,7 @@ end
|
|
81
86
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
82
87
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
83
88
|
end
|
84
|
-
req.body = { **(request_options&.additional_body_parameters || {}), name: name, description: description, agentCode: agent_code, externalId: external_id }.compact
|
89
|
+
req.body = { **(request_options&.additional_body_parameters || {}), name: name, description: description, agentCode: agent_code, externalId: external_id, active: active }.compact
|
85
90
|
req.url "#{@request_client.get_url(request_options: request_options)}/agents"
|
86
91
|
end
|
87
92
|
Paid::Agent.from_json(json_object: response.body)
|
@@ -131,7 +136,7 @@ end
|
|
131
136
|
# environment: Paid::Environment::PRODUCTION,
|
132
137
|
# token: "YOUR_AUTH_TOKEN"
|
133
138
|
# )
|
134
|
-
# api.agents.update(agent_id: "agentId", request: {
|
139
|
+
# api.agents.update(agent_id: "agentId", request: { name: "Acme Agent (Updated)", agent_attributes: [{ name: "Emails sent signal", active: true, pricing: { event_name: "emails_sent", taxable: true, charge_type: USAGE, pricing_model: PER_UNIT, billing_frequency: MONTHLY, price_points: { "USD": { tiers: [{ min_quantity: 0, max_quantity: 10, unit_price: 100 }, { min_quantity: 11, max_quantity: 100, unit_price: 90 }, { min_quantity: 101, unit_price: 80 }] } } } }] })
|
135
140
|
def update(agent_id:, request:, request_options: nil)
|
136
141
|
response = @request_client.conn.put do | req |
|
137
142
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -222,7 +227,7 @@ end
|
|
222
227
|
# environment: Paid::Environment::PRODUCTION,
|
223
228
|
# token: "YOUR_AUTH_TOKEN"
|
224
229
|
# )
|
225
|
-
# api.agents.update_by_external_id(external_id: "externalId", request: {
|
230
|
+
# api.agents.update_by_external_id(external_id: "externalId", request: { name: "Acme Agent (Updated)", agent_attributes: [{ name: "Emails sent signal", active: true, pricing: { event_name: "emails_sent", taxable: true, charge_type: USAGE, pricing_model: PER_UNIT, billing_frequency: MONTHLY, price_points: { "USD": { unit_price: 150 } } } }] })
|
226
231
|
def update_by_external_id(external_id:, request:, request_options: nil)
|
227
232
|
response = @request_client.conn.put do | req |
|
228
233
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -317,6 +322,7 @@ end
|
|
317
322
|
# @param description [String]
|
318
323
|
# @param agent_code [String]
|
319
324
|
# @param external_id [String]
|
325
|
+
# @param active [Boolean]
|
320
326
|
# @param request_options [Paid::RequestOptions]
|
321
327
|
# @return [Paid::Agent]
|
322
328
|
# @example
|
@@ -325,8 +331,12 @@ end
|
|
325
331
|
# environment: Paid::Environment::PRODUCTION,
|
326
332
|
# token: "YOUR_AUTH_TOKEN"
|
327
333
|
# )
|
328
|
-
# api.agents.create(
|
329
|
-
|
334
|
+
# api.agents.create(
|
335
|
+
# name: "Acme Agent",
|
336
|
+
# description: "Acme Agent is an AI agent that does things.",
|
337
|
+
# external_id: "acme-agent"
|
338
|
+
# )
|
339
|
+
def create(name:, description:, agent_code: nil, external_id: nil, active: nil, request_options: nil)
|
330
340
|
Async do
|
331
341
|
response = @request_client.conn.post do | req |
|
332
342
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -339,7 +349,7 @@ end
|
|
339
349
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
340
350
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
341
351
|
end
|
342
|
-
req.body = { **(request_options&.additional_body_parameters || {}), name: name, description: description, agentCode: agent_code, externalId: external_id }.compact
|
352
|
+
req.body = { **(request_options&.additional_body_parameters || {}), name: name, description: description, agentCode: agent_code, externalId: external_id, active: active }.compact
|
343
353
|
req.url "#{@request_client.get_url(request_options: request_options)}/agents"
|
344
354
|
end
|
345
355
|
Paid::Agent.from_json(json_object: response.body)
|
@@ -392,7 +402,7 @@ end
|
|
392
402
|
# environment: Paid::Environment::PRODUCTION,
|
393
403
|
# token: "YOUR_AUTH_TOKEN"
|
394
404
|
# )
|
395
|
-
# api.agents.update(agent_id: "agentId", request: {
|
405
|
+
# api.agents.update(agent_id: "agentId", request: { name: "Acme Agent (Updated)", agent_attributes: [{ name: "Emails sent signal", active: true, pricing: { event_name: "emails_sent", taxable: true, charge_type: USAGE, pricing_model: PER_UNIT, billing_frequency: MONTHLY, price_points: { "USD": { tiers: [{ min_quantity: 0, max_quantity: 10, unit_price: 100 }, { min_quantity: 11, max_quantity: 100, unit_price: 90 }, { min_quantity: 101, unit_price: 80 }] } } } }] })
|
396
406
|
def update(agent_id:, request:, request_options: nil)
|
397
407
|
Async do
|
398
408
|
response = @request_client.conn.put do | req |
|
@@ -489,7 +499,7 @@ end
|
|
489
499
|
# environment: Paid::Environment::PRODUCTION,
|
490
500
|
# token: "YOUR_AUTH_TOKEN"
|
491
501
|
# )
|
492
|
-
# api.agents.update_by_external_id(external_id: "externalId", request: {
|
502
|
+
# api.agents.update_by_external_id(external_id: "externalId", request: { name: "Acme Agent (Updated)", agent_attributes: [{ name: "Emails sent signal", active: true, pricing: { event_name: "emails_sent", taxable: true, charge_type: USAGE, pricing_model: PER_UNIT, billing_frequency: MONTHLY, price_points: { "USD": { unit_price: 150 } } } }] })
|
493
503
|
def update_by_external_id(external_id:, request:, request_options: nil)
|
494
504
|
Async do
|
495
505
|
response = @request_client.conn.put do | req |
|
@@ -76,16 +76,13 @@ end
|
|
76
76
|
# token: "YOUR_AUTH_TOKEN"
|
77
77
|
# )
|
78
78
|
# api.contacts.create(
|
79
|
+
# customer_external_id: "acme-inc",
|
79
80
|
# salutation: MR,
|
80
|
-
# first_name: "
|
81
|
-
# last_name: "
|
82
|
-
# email: "
|
83
|
-
# billing_street: "billingStreet",
|
84
|
-
# billing_city: "billingCity",
|
85
|
-
# billing_country: "billingCountry",
|
86
|
-
# billing_postal_code: "billingPostalCode"
|
81
|
+
# first_name: "John",
|
82
|
+
# last_name: "Doe",
|
83
|
+
# email: "john.doe@example.com"
|
87
84
|
# )
|
88
|
-
def create(external_id: nil, customer_id: nil, customer_external_id: nil, salutation:, first_name:, last_name:, email:, phone: nil, billing_street
|
85
|
+
def create(external_id: nil, customer_id: nil, customer_external_id: nil, salutation:, first_name:, last_name:, email:, phone: nil, billing_street: nil, billing_city: nil, billing_state_province: nil, billing_country: nil, billing_postal_code: nil, request_options: nil)
|
89
86
|
response = @request_client.conn.post do | req |
|
90
87
|
unless request_options&.timeout_in_seconds.nil?
|
91
88
|
req.options.timeout = request_options.timeout_in_seconds
|
@@ -283,16 +280,13 @@ end
|
|
283
280
|
# token: "YOUR_AUTH_TOKEN"
|
284
281
|
# )
|
285
282
|
# api.contacts.create(
|
283
|
+
# customer_external_id: "acme-inc",
|
286
284
|
# salutation: MR,
|
287
|
-
# first_name: "
|
288
|
-
# last_name: "
|
289
|
-
# email: "
|
290
|
-
# billing_street: "billingStreet",
|
291
|
-
# billing_city: "billingCity",
|
292
|
-
# billing_country: "billingCountry",
|
293
|
-
# billing_postal_code: "billingPostalCode"
|
285
|
+
# first_name: "John",
|
286
|
+
# last_name: "Doe",
|
287
|
+
# email: "john.doe@example.com"
|
294
288
|
# )
|
295
|
-
def create(external_id: nil, customer_id: nil, customer_external_id: nil, salutation:, first_name:, last_name:, email:, phone: nil, billing_street
|
289
|
+
def create(external_id: nil, customer_id: nil, customer_external_id: nil, salutation:, first_name:, last_name:, email:, phone: nil, billing_street: nil, billing_city: nil, billing_state_province: nil, billing_country: nil, billing_postal_code: nil, request_options: nil)
|
296
290
|
Async do
|
297
291
|
response = @request_client.conn.post do | req |
|
298
292
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -82,7 +82,7 @@ end
|
|
82
82
|
# environment: Paid::Environment::PRODUCTION,
|
83
83
|
# token: "YOUR_AUTH_TOKEN"
|
84
84
|
# )
|
85
|
-
# api.customers.create(name: "
|
85
|
+
# api.customers.create(name: "Acme, Inc.", external_id: "acme-inc")
|
86
86
|
def create(name:, external_id: nil, phone: nil, employee_count: nil, annual_revenue: nil, tax_exempt_status: nil, creation_source: nil, website: nil, billing_address: nil, request_options: nil)
|
87
87
|
response = @request_client.conn.post do | req |
|
88
88
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -154,7 +154,7 @@ end
|
|
154
154
|
# environment: Paid::Environment::PRODUCTION,
|
155
155
|
# token: "YOUR_AUTH_TOKEN"
|
156
156
|
# )
|
157
|
-
# api.customers.update(customer_id: "customerId", request: {
|
157
|
+
# api.customers.update(customer_id: "customerId", request: { name: "Acme, Inc. (Updated)", phone: "123-456-7890", employee_count: 101, annual_revenue: 1000001 })
|
158
158
|
def update(customer_id:, request:, request_options: nil)
|
159
159
|
response = @request_client.conn.put do | req |
|
160
160
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -368,7 +368,7 @@ end
|
|
368
368
|
# environment: Paid::Environment::PRODUCTION,
|
369
369
|
# token: "YOUR_AUTH_TOKEN"
|
370
370
|
# )
|
371
|
-
# api.customers.create(name: "
|
371
|
+
# api.customers.create(name: "Acme, Inc.", external_id: "acme-inc")
|
372
372
|
def create(name:, external_id: nil, phone: nil, employee_count: nil, annual_revenue: nil, tax_exempt_status: nil, creation_source: nil, website: nil, billing_address: nil, request_options: nil)
|
373
373
|
Async do
|
374
374
|
response = @request_client.conn.post do | req |
|
@@ -444,7 +444,7 @@ end
|
|
444
444
|
# environment: Paid::Environment::PRODUCTION,
|
445
445
|
# token: "YOUR_AUTH_TOKEN"
|
446
446
|
# )
|
447
|
-
# api.customers.update(customer_id: "customerId", request: {
|
447
|
+
# api.customers.update(customer_id: "customerId", request: { name: "Acme, Inc. (Updated)", phone: "123-456-7890", employee_count: 101, annual_revenue: 1000001 })
|
448
448
|
def update(customer_id:, request:, request_options: nil)
|
449
449
|
Async do
|
450
450
|
response = @request_client.conn.put do | req |
|
@@ -79,13 +79,14 @@ end
|
|
79
79
|
# token: "YOUR_AUTH_TOKEN"
|
80
80
|
# )
|
81
81
|
# api.orders.create(
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# start_date: "
|
86
|
-
#
|
82
|
+
# customer_external_id: "acme-inc",
|
83
|
+
# name: "Acme Order",
|
84
|
+
# description: "Acme Order is an order for Acme, Inc.",
|
85
|
+
# start_date: "2025-01-01",
|
86
|
+
# end_date: "2026-01-01",
|
87
|
+
# currency: "USD"
|
87
88
|
# )
|
88
|
-
def create(customer_id
|
89
|
+
def create(customer_id: nil, customer_external_id: nil, billing_contact_id: nil, name:, description: nil, start_date:, end_date: nil, currency:, order_lines: nil, request_options: nil)
|
89
90
|
response = @request_client.conn.post do | req |
|
90
91
|
unless request_options&.timeout_in_seconds.nil?
|
91
92
|
req.options.timeout = request_options.timeout_in_seconds
|
@@ -258,13 +259,14 @@ end
|
|
258
259
|
# token: "YOUR_AUTH_TOKEN"
|
259
260
|
# )
|
260
261
|
# api.orders.create(
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
# start_date: "
|
265
|
-
#
|
262
|
+
# customer_external_id: "acme-inc",
|
263
|
+
# name: "Acme Order",
|
264
|
+
# description: "Acme Order is an order for Acme, Inc.",
|
265
|
+
# start_date: "2025-01-01",
|
266
|
+
# end_date: "2026-01-01",
|
267
|
+
# currency: "USD"
|
266
268
|
# )
|
267
|
-
def create(customer_id
|
269
|
+
def create(customer_id: nil, customer_external_id: nil, billing_contact_id: nil, name:, description: nil, start_date:, end_date: nil, currency:, order_lines: nil, request_options: nil)
|
268
270
|
Async do
|
269
271
|
response = @request_client.conn.post do | req |
|
270
272
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -31,7 +31,7 @@ module Paid
|
|
31
31
|
# environment: Paid::Environment::PRODUCTION,
|
32
32
|
# token: "YOUR_AUTH_TOKEN"
|
33
33
|
# )
|
34
|
-
# api.orders.lines.update(order_id: "orderId")
|
34
|
+
# api.orders.lines.update(order_id: "orderId", lines: [{ agent_external_id: "acme-agent", name: "Order Line One", description: "Order Line One is an order line for Acme, Inc." }, { agent_external_id: "acme-agent-2", name: "Order Line Two", description: "Order Line Two is an order line for Acme, Inc." }])
|
35
35
|
def update(order_id:, lines: nil, request_options: nil)
|
36
36
|
response = @request_client.conn.put do | req |
|
37
37
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -74,7 +74,7 @@ end
|
|
74
74
|
# environment: Paid::Environment::PRODUCTION,
|
75
75
|
# token: "YOUR_AUTH_TOKEN"
|
76
76
|
# )
|
77
|
-
# api.orders.lines.update(order_id: "orderId")
|
77
|
+
# api.orders.lines.update(order_id: "orderId", lines: [{ agent_external_id: "acme-agent", name: "Order Line One", description: "Order Line One is an order line for Acme, Inc." }, { agent_external_id: "acme-agent-2", name: "Order Line Two", description: "Order Line Two is an order line for Acme, Inc." }])
|
78
78
|
def update(order_id:, lines: nil, request_options: nil)
|
79
79
|
Async do
|
80
80
|
response = @request_client.conn.put do | req |
|
@@ -11,6 +11,8 @@ module Paid
|
|
11
11
|
attr_reader :event_name
|
12
12
|
# @return [Boolean]
|
13
13
|
attr_reader :taxable
|
14
|
+
# @return [Float]
|
15
|
+
attr_reader :credit_cost
|
14
16
|
# @return [Paid::ChargeType]
|
15
17
|
attr_reader :charge_type
|
16
18
|
# @return [Paid::PricingModelType]
|
@@ -29,21 +31,23 @@ module Paid
|
|
29
31
|
|
30
32
|
# @param event_name [String]
|
31
33
|
# @param taxable [Boolean]
|
34
|
+
# @param credit_cost [Float]
|
32
35
|
# @param charge_type [Paid::ChargeType]
|
33
36
|
# @param pricing_model [Paid::PricingModelType]
|
34
37
|
# @param billing_frequency [Paid::BillingFrequency]
|
35
38
|
# @param price_points [Hash{String => Paid::AgentPricePoint}]
|
36
39
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
37
40
|
# @return [Paid::Pricing]
|
38
|
-
def initialize(event_name: OMIT, taxable:, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil)
|
41
|
+
def initialize(event_name: OMIT, taxable:, credit_cost: OMIT, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil)
|
39
42
|
@event_name = event_name if event_name != OMIT
|
40
43
|
@taxable = taxable
|
44
|
+
@credit_cost = credit_cost if credit_cost != OMIT
|
41
45
|
@charge_type = charge_type
|
42
46
|
@pricing_model = pricing_model
|
43
47
|
@billing_frequency = billing_frequency
|
44
48
|
@price_points = price_points
|
45
49
|
@additional_properties = additional_properties
|
46
|
-
@_field_set = { "eventName": event_name, "taxable": taxable, "chargeType": charge_type, "pricingModel": pricing_model, "billingFrequency": billing_frequency, "pricePoints": price_points }.reject do | _k, v |
|
50
|
+
@_field_set = { "eventName": event_name, "taxable": taxable, "creditCost": credit_cost, "chargeType": charge_type, "pricingModel": pricing_model, "billingFrequency": billing_frequency, "pricePoints": price_points }.reject do | _k, v |
|
47
51
|
v == OMIT
|
48
52
|
end
|
49
53
|
end
|
@@ -56,6 +60,7 @@ end
|
|
56
60
|
parsed_json = JSON.parse(json_object)
|
57
61
|
event_name = parsed_json["eventName"]
|
58
62
|
taxable = parsed_json["taxable"]
|
63
|
+
credit_cost = parsed_json["creditCost"]
|
59
64
|
charge_type = parsed_json["chargeType"]
|
60
65
|
pricing_model = parsed_json["pricingModel"]
|
61
66
|
billing_frequency = parsed_json["billingFrequency"]
|
@@ -66,6 +71,7 @@ end
|
|
66
71
|
new(
|
67
72
|
event_name: event_name,
|
68
73
|
taxable: taxable,
|
74
|
+
credit_cost: credit_cost,
|
69
75
|
charge_type: charge_type,
|
70
76
|
pricing_model: pricing_model,
|
71
77
|
billing_frequency: billing_frequency,
|
@@ -88,6 +94,7 @@ end
|
|
88
94
|
def self.validate_raw(obj:)
|
89
95
|
obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.")
|
90
96
|
obj.taxable.is_a?(Boolean) != false || raise("Passed value for field obj.taxable is not the expected type, validation failed.")
|
97
|
+
obj.credit_cost&.is_a?(Float) != false || raise("Passed value for field obj.credit_cost is not the expected type, validation failed.")
|
91
98
|
obj.charge_type.is_a?(Paid::ChargeType) != false || raise("Passed value for field obj.charge_type is not the expected type, validation failed.")
|
92
99
|
obj.pricing_model.is_a?(Paid::PricingModelType) != false || raise("Passed value for field obj.pricing_model is not the expected type, validation failed.")
|
93
100
|
obj.billing_frequency.is_a?(Paid::BillingFrequency) != false || raise("Passed value for field obj.billing_frequency is not the expected type, validation failed.")
|
@@ -8,6 +8,8 @@ module Paid
|
|
8
8
|
attr_reader :event_name
|
9
9
|
# @return [String]
|
10
10
|
attr_reader :agent_id
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :external_agent_id
|
11
13
|
# @return [String]
|
12
14
|
attr_reader :customer_id
|
13
15
|
# @return [Hash{String => Object}]
|
@@ -22,17 +24,19 @@ module Paid
|
|
22
24
|
|
23
25
|
# @param event_name [String]
|
24
26
|
# @param agent_id [String]
|
27
|
+
# @param external_agent_id [String]
|
25
28
|
# @param customer_id [String]
|
26
29
|
# @param data [Hash{String => Object}]
|
27
30
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
31
|
# @return [Paid::Signal]
|
29
|
-
def initialize(event_name: OMIT, agent_id: OMIT, customer_id: OMIT, data: OMIT, additional_properties: nil)
|
32
|
+
def initialize(event_name: OMIT, agent_id: OMIT, external_agent_id: OMIT, customer_id: OMIT, data: OMIT, additional_properties: nil)
|
30
33
|
@event_name = event_name if event_name != OMIT
|
31
34
|
@agent_id = agent_id if agent_id != OMIT
|
35
|
+
@external_agent_id = external_agent_id if external_agent_id != OMIT
|
32
36
|
@customer_id = customer_id if customer_id != OMIT
|
33
37
|
@data = data if data != OMIT
|
34
38
|
@additional_properties = additional_properties
|
35
|
-
@_field_set = { "event_name": event_name, "agent_id": agent_id, "customer_id": customer_id, "data": data }.reject do | _k, v |
|
39
|
+
@_field_set = { "event_name": event_name, "agent_id": agent_id, "external_agent_id": external_agent_id, "customer_id": customer_id, "data": data }.reject do | _k, v |
|
36
40
|
v == OMIT
|
37
41
|
end
|
38
42
|
end
|
@@ -45,11 +49,13 @@ end
|
|
45
49
|
parsed_json = JSON.parse(json_object)
|
46
50
|
event_name = parsed_json["event_name"]
|
47
51
|
agent_id = parsed_json["agent_id"]
|
52
|
+
external_agent_id = parsed_json["external_agent_id"]
|
48
53
|
customer_id = parsed_json["customer_id"]
|
49
54
|
data = parsed_json["data"]
|
50
55
|
new(
|
51
56
|
event_name: event_name,
|
52
57
|
agent_id: agent_id,
|
58
|
+
external_agent_id: external_agent_id,
|
53
59
|
customer_id: customer_id,
|
54
60
|
data: data,
|
55
61
|
additional_properties: struct
|
@@ -70,6 +76,7 @@ end
|
|
70
76
|
def self.validate_raw(obj:)
|
71
77
|
obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.")
|
72
78
|
obj.agent_id&.is_a?(String) != false || raise("Passed value for field obj.agent_id is not the expected type, validation failed.")
|
79
|
+
obj.external_agent_id&.is_a?(String) != false || raise("Passed value for field obj.external_agent_id is not the expected type, validation failed.")
|
73
80
|
obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
|
74
81
|
obj.data&.is_a?(Hash) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
|
75
82
|
end
|
@@ -19,6 +19,7 @@ module Paid
|
|
19
19
|
# @param signals [Array<Hash>] Request of type Array<Paid::Signal>, as a Hash
|
20
20
|
# * :event_name (String)
|
21
21
|
# * :agent_id (String)
|
22
|
+
# * :external_agent_id (String)
|
22
23
|
# * :customer_id (String)
|
23
24
|
# * :data (Hash{String => Object})
|
24
25
|
# @param request_options [Paid::RequestOptions]
|
@@ -29,7 +30,7 @@ module Paid
|
|
29
30
|
# environment: Paid::Environment::PRODUCTION,
|
30
31
|
# token: "YOUR_AUTH_TOKEN"
|
31
32
|
# )
|
32
|
-
# api.usage.record_bulk
|
33
|
+
# api.usage.record_bulk(signals: [{ }, { }, { }])
|
33
34
|
def record_bulk(signals: nil, request_options: nil)
|
34
35
|
response = @request_client.conn.post do | req |
|
35
36
|
unless request_options&.timeout_in_seconds.nil?
|
@@ -62,6 +63,7 @@ end
|
|
62
63
|
# @param signals [Array<Hash>] Request of type Array<Paid::Signal>, as a Hash
|
63
64
|
# * :event_name (String)
|
64
65
|
# * :agent_id (String)
|
66
|
+
# * :external_agent_id (String)
|
65
67
|
# * :customer_id (String)
|
66
68
|
# * :data (Hash{String => Object})
|
67
69
|
# @param request_options [Paid::RequestOptions]
|
@@ -72,7 +74,7 @@ end
|
|
72
74
|
# environment: Paid::Environment::PRODUCTION,
|
73
75
|
# token: "YOUR_AUTH_TOKEN"
|
74
76
|
# )
|
75
|
-
# api.usage.record_bulk
|
77
|
+
# api.usage.record_bulk(signals: [{ }, { }, { }])
|
76
78
|
def record_bulk(signals: nil, request_options: nil)
|
77
79
|
Async do
|
78
80
|
response = @request_client.conn.post do | req |
|
data/lib/requests.rb
CHANGED
@@ -47,7 +47,7 @@ end
|
|
47
47
|
end
|
48
48
|
# @return [Hash{String => String}]
|
49
49
|
def get_headers
|
50
|
-
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'paid_ruby', "X-Fern-SDK-Version": '0.1.1' }
|
50
|
+
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'paid_ruby', "X-Fern-SDK-Version": '0.1.1-rc5' }
|
51
51
|
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
|
52
52
|
headers
|
53
53
|
end
|
@@ -92,7 +92,7 @@ end
|
|
92
92
|
end
|
93
93
|
# @return [Hash{String => String}]
|
94
94
|
def get_headers
|
95
|
-
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'paid_ruby', "X-Fern-SDK-Version": '0.1.1' }
|
95
|
+
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'paid_ruby', "X-Fern-SDK-Version": '0.1.1-rc5' }
|
96
96
|
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
|
97
97
|
headers
|
98
98
|
end
|
metadata
CHANGED
@@ -1,35 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paid_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1.pre.
|
4
|
+
version: 0.1.1.pre.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
13
|
+
name: opentelemetry-api
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
18
|
+
version: '1.5'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
21
24
|
- !ruby/object:Gem::Version
|
22
|
-
version: '1.
|
25
|
+
version: '1.5'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: opentelemetry-exporter-otlp
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.30.0
|
23
33
|
type: :runtime
|
24
34
|
prerelease: false
|
25
35
|
version_requirements: !ruby/object:Gem::Requirement
|
26
36
|
requirements:
|
27
|
-
- - "
|
37
|
+
- - "~>"
|
28
38
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
|
39
|
+
version: 0.30.0
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: opentelemetry-sdk
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
31
45
|
- !ruby/object:Gem::Version
|
32
|
-
version: '1.
|
46
|
+
version: '1.8'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.8'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: ruby-openai
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '8.1'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '8.1'
|
33
68
|
- !ruby/object:Gem::Dependency
|
34
69
|
name: faraday
|
35
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,89 +126,25 @@ dependencies:
|
|
91
126
|
- !ruby/object:Gem::Version
|
92
127
|
version: '3.0'
|
93
128
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '1.5'
|
100
|
-
type: :runtime
|
101
|
-
prerelease: false
|
102
|
-
version_requirements: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - "~>"
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: '1.5'
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
name: opentelemetry-exporter-otlp
|
109
|
-
requirement: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: 0.30.0
|
114
|
-
type: :runtime
|
115
|
-
prerelease: false
|
116
|
-
version_requirements: !ruby/object:Gem::Requirement
|
117
|
-
requirements:
|
118
|
-
- - "~>"
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: 0.30.0
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
|
-
name: opentelemetry-sdk
|
123
|
-
requirement: !ruby/object:Gem::Requirement
|
124
|
-
requirements:
|
125
|
-
- - "~>"
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '1.8'
|
128
|
-
type: :runtime
|
129
|
-
prerelease: false
|
130
|
-
version_requirements: !ruby/object:Gem::Requirement
|
131
|
-
requirements:
|
132
|
-
- - "~>"
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: '1.8'
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
name: ostruct
|
129
|
+
name: async-http-faraday
|
137
130
|
requirement: !ruby/object:Gem::Requirement
|
138
131
|
requirements:
|
139
132
|
- - ">="
|
140
133
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
|
143
|
-
prerelease: false
|
144
|
-
version_requirements: !ruby/object:Gem::Requirement
|
145
|
-
requirements:
|
146
|
-
- - ">="
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '0'
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: rake
|
151
|
-
requirement: !ruby/object:Gem::Requirement
|
152
|
-
requirements:
|
153
|
-
- - "~>"
|
134
|
+
version: '0.0'
|
135
|
+
- - "<"
|
154
136
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
137
|
+
version: '1.0'
|
156
138
|
type: :runtime
|
157
139
|
prerelease: false
|
158
140
|
version_requirements: !ruby/object:Gem::Requirement
|
159
141
|
requirements:
|
160
|
-
- - "
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: '13.0'
|
163
|
-
- !ruby/object:Gem::Dependency
|
164
|
-
name: ruby-openai
|
165
|
-
requirement: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
142
|
+
- - ">="
|
168
143
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
170
|
-
|
171
|
-
prerelease: false
|
172
|
-
version_requirements: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
144
|
+
version: '0.0'
|
145
|
+
- - "<"
|
175
146
|
- !ruby/object:Gem::Version
|
176
|
-
version: '
|
147
|
+
version: '1.0'
|
177
148
|
description: ''
|
178
149
|
email: ''
|
179
150
|
executables: []
|
@@ -228,7 +199,6 @@ metadata:
|
|
228
199
|
homepage_uri: https://github.com/paid-ai/paid-ruby
|
229
200
|
source_code_uri: https://github.com/paid-ai/paid-ruby
|
230
201
|
changelog_uri: https://github.com/paid-ai/paid-ruby/blob/master/CHANGELOG.md
|
231
|
-
post_install_message:
|
232
202
|
rdoc_options: []
|
233
203
|
require_paths:
|
234
204
|
- lib
|
@@ -236,15 +206,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
206
|
requirements:
|
237
207
|
- - ">="
|
238
208
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
209
|
+
version: 2.7.0
|
240
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
211
|
requirements:
|
242
|
-
- - "
|
212
|
+
- - ">="
|
243
213
|
- !ruby/object:Gem::Version
|
244
|
-
version:
|
214
|
+
version: '0'
|
245
215
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
247
|
-
signing_key:
|
216
|
+
rubygems_version: 3.6.7
|
248
217
|
specification_version: 4
|
249
218
|
summary: ''
|
250
219
|
test_files: []
|