paid_ruby 0.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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/lib/environment.rb +9 -0
  3. data/lib/extensions/batch.rb +41 -0
  4. data/lib/gemconfig.rb +13 -0
  5. data/lib/paid_ruby/agents/client.rb +543 -0
  6. data/lib/paid_ruby/contacts/client.rb +437 -0
  7. data/lib/paid_ruby/customers/client.rb +604 -0
  8. data/lib/paid_ruby/orders/client.rb +379 -0
  9. data/lib/paid_ruby/orders/lines/client.rb +99 -0
  10. data/lib/paid_ruby/types/address.rb +91 -0
  11. data/lib/paid_ruby/types/agent.rb +109 -0
  12. data/lib/paid_ruby/types/agent_attribute.rb +74 -0
  13. data/lib/paid_ruby/types/agent_price_point.rb +81 -0
  14. data/lib/paid_ruby/types/agent_price_point_tiers.rb +70 -0
  15. data/lib/paid_ruby/types/agent_update.rb +95 -0
  16. data/lib/paid_ruby/types/api_error.rb +54 -0
  17. data/lib/paid_ruby/types/billing_frequency.rb +11 -0
  18. data/lib/paid_ruby/types/charge_type.rb +12 -0
  19. data/lib/paid_ruby/types/contact.rb +155 -0
  20. data/lib/paid_ruby/types/creation_source.rb +12 -0
  21. data/lib/paid_ruby/types/creation_state.rb +10 -0
  22. data/lib/paid_ruby/types/customer.rb +142 -0
  23. data/lib/paid_ruby/types/customer_update.rb +120 -0
  24. data/lib/paid_ruby/types/error.rb +58 -0
  25. data/lib/paid_ruby/types/order.rb +172 -0
  26. data/lib/paid_ruby/types/order_line.rb +158 -0
  27. data/lib/paid_ruby/types/order_line_attribute.rb +83 -0
  28. data/lib/paid_ruby/types/order_line_attribute_pricing.rb +93 -0
  29. data/lib/paid_ruby/types/order_line_create.rb +77 -0
  30. data/lib/paid_ruby/types/price_point.rb +81 -0
  31. data/lib/paid_ruby/types/pricing.rb +97 -0
  32. data/lib/paid_ruby/types/pricing_model_type.rb +11 -0
  33. data/lib/paid_ruby/types/salutation.rb +14 -0
  34. data/lib/paid_ruby/types/signal.rb +77 -0
  35. data/lib/paid_ruby/types/tax_exempt_status.rb +11 -0
  36. data/lib/paid_ruby/types/tier.rb +70 -0
  37. data/lib/paid_ruby/usage/client.rb +97 -0
  38. data/lib/paid_ruby.rb +83 -0
  39. data/lib/requests.rb +166 -0
  40. data/lib/types_export.rb +28 -0
  41. metadata +163 -0
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+ require_relative "order_line_attribute_pricing"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Paid
7
+ class OrderLineAttribute
8
+ # @return [String]
9
+ attr_reader :agent_attribute_id
10
+ # @return [Float]
11
+ attr_reader :quantity
12
+ # @return [String]
13
+ attr_reader :currency
14
+ # @return [Paid::OrderLineAttributePricing]
15
+ attr_reader :pricing
16
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
17
+ attr_reader :additional_properties
18
+ # @return [Object]
19
+ attr_reader :_field_set
20
+ protected :_field_set
21
+
22
+ OMIT = Object.new
23
+
24
+ # @param agent_attribute_id [String]
25
+ # @param quantity [Float]
26
+ # @param currency [String]
27
+ # @param pricing [Paid::OrderLineAttributePricing]
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Paid::OrderLineAttribute]
30
+ def initialize(agent_attribute_id: OMIT, quantity: OMIT, currency: OMIT, pricing: OMIT, additional_properties: nil)
31
+ @agent_attribute_id = agent_attribute_id if agent_attribute_id != OMIT
32
+ @quantity = quantity if quantity != OMIT
33
+ @currency = currency if currency != OMIT
34
+ @pricing = pricing if pricing != OMIT
35
+ @additional_properties = additional_properties
36
+ @_field_set = { "agentAttributeId": agent_attribute_id, "quantity": quantity, "currency": currency, "pricing": pricing }.reject do | _k, v |
37
+ v == OMIT
38
+ end
39
+ end
40
+ # Deserialize a JSON object to an instance of OrderLineAttribute
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Paid::OrderLineAttribute]
44
+ def self.from_json(json_object:)
45
+ struct = JSON.parse(json_object, object_class: OpenStruct)
46
+ parsed_json = JSON.parse(json_object)
47
+ agent_attribute_id = parsed_json["agentAttributeId"]
48
+ quantity = parsed_json["quantity"]
49
+ currency = parsed_json["currency"]
50
+ unless parsed_json["pricing"].nil?
51
+ pricing = parsed_json["pricing"].to_json
52
+ pricing = Paid::OrderLineAttributePricing.from_json(json_object: pricing)
53
+ else
54
+ pricing = nil
55
+ end
56
+ new(
57
+ agent_attribute_id: agent_attribute_id,
58
+ quantity: quantity,
59
+ currency: currency,
60
+ pricing: pricing,
61
+ additional_properties: struct
62
+ )
63
+ end
64
+ # Serialize an instance of OrderLineAttribute to a JSON object
65
+ #
66
+ # @return [String]
67
+ def to_json
68
+ @_field_set&.to_json
69
+ end
70
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
71
+ # hash and check each fields type against the current object's property
72
+ # definitions.
73
+ #
74
+ # @param obj [Object]
75
+ # @return [Void]
76
+ def self.validate_raw(obj:)
77
+ obj.agent_attribute_id&.is_a?(String) != false || raise("Passed value for field obj.agent_attribute_id is not the expected type, validation failed.")
78
+ obj.quantity&.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
79
+ obj.currency&.is_a?(String) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.")
80
+ obj.pricing.nil? || Paid::OrderLineAttributePricing.validate_raw(obj: obj.pricing)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+ require_relative "charge_type"
3
+ require_relative "price_point"
4
+ require_relative "pricing_model_type"
5
+ require_relative "billing_frequency"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module Paid
10
+ class OrderLineAttributePricing
11
+ # @return [String]
12
+ attr_reader :event_name
13
+ # @return [Paid::ChargeType]
14
+ attr_reader :charge_type
15
+ # @return [Paid::PricePoint]
16
+ attr_reader :price_point
17
+ # @return [Paid::PricingModelType]
18
+ attr_reader :pricing_model
19
+ # @return [Paid::BillingFrequency]
20
+ attr_reader :billing_frequency
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param event_name [String]
30
+ # @param charge_type [Paid::ChargeType]
31
+ # @param price_point [Paid::PricePoint]
32
+ # @param pricing_model [Paid::PricingModelType]
33
+ # @param billing_frequency [Paid::BillingFrequency]
34
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
35
+ # @return [Paid::OrderLineAttributePricing]
36
+ def initialize(event_name: OMIT, charge_type: OMIT, price_point: OMIT, pricing_model: OMIT, billing_frequency: OMIT, additional_properties: nil)
37
+ @event_name = event_name if event_name != OMIT
38
+ @charge_type = charge_type if charge_type != OMIT
39
+ @price_point = price_point if price_point != OMIT
40
+ @pricing_model = pricing_model if pricing_model != OMIT
41
+ @billing_frequency = billing_frequency if billing_frequency != OMIT
42
+ @additional_properties = additional_properties
43
+ @_field_set = { "eventName": event_name, "chargeType": charge_type, "pricePoint": price_point, "pricingModel": pricing_model, "billingFrequency": billing_frequency }.reject do | _k, v |
44
+ v == OMIT
45
+ end
46
+ end
47
+ # Deserialize a JSON object to an instance of OrderLineAttributePricing
48
+ #
49
+ # @param json_object [String]
50
+ # @return [Paid::OrderLineAttributePricing]
51
+ def self.from_json(json_object:)
52
+ struct = JSON.parse(json_object, object_class: OpenStruct)
53
+ parsed_json = JSON.parse(json_object)
54
+ event_name = parsed_json["eventName"]
55
+ charge_type = parsed_json["chargeType"]
56
+ unless parsed_json["pricePoint"].nil?
57
+ price_point = parsed_json["pricePoint"].to_json
58
+ price_point = Paid::PricePoint.from_json(json_object: price_point)
59
+ else
60
+ price_point = nil
61
+ end
62
+ pricing_model = parsed_json["pricingModel"]
63
+ billing_frequency = parsed_json["billingFrequency"]
64
+ new(
65
+ event_name: event_name,
66
+ charge_type: charge_type,
67
+ price_point: price_point,
68
+ pricing_model: pricing_model,
69
+ billing_frequency: billing_frequency,
70
+ additional_properties: struct
71
+ )
72
+ end
73
+ # Serialize an instance of OrderLineAttributePricing to a JSON object
74
+ #
75
+ # @return [String]
76
+ def to_json
77
+ @_field_set&.to_json
78
+ end
79
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
80
+ # hash and check each fields type against the current object's property
81
+ # definitions.
82
+ #
83
+ # @param obj [Object]
84
+ # @return [Void]
85
+ def self.validate_raw(obj:)
86
+ obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.")
87
+ obj.charge_type&.is_a?(Paid::ChargeType) != false || raise("Passed value for field obj.charge_type is not the expected type, validation failed.")
88
+ obj.price_point.nil? || Paid::PricePoint.validate_raw(obj: obj.price_point)
89
+ obj.pricing_model&.is_a?(Paid::PricingModelType) != false || raise("Passed value for field obj.pricing_model is not the expected type, validation failed.")
90
+ obj.billing_frequency&.is_a?(Paid::BillingFrequency) != false || raise("Passed value for field obj.billing_frequency is not the expected type, validation failed.")
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Paid
6
+ class OrderLineCreate
7
+ # @return [String]
8
+ attr_reader :agent_id
9
+ # @return [String]
10
+ attr_reader :agent_external_id
11
+ # @return [String]
12
+ attr_reader :name
13
+ # @return [String]
14
+ attr_reader :description
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param agent_id [String]
24
+ # @param agent_external_id [String]
25
+ # @param name [String]
26
+ # @param description [String]
27
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
+ # @return [Paid::OrderLineCreate]
29
+ def initialize(agent_id: OMIT, agent_external_id: OMIT, name: OMIT, description: OMIT, additional_properties: nil)
30
+ @agent_id = agent_id if agent_id != OMIT
31
+ @agent_external_id = agent_external_id if agent_external_id != OMIT
32
+ @name = name if name != OMIT
33
+ @description = description if description != OMIT
34
+ @additional_properties = additional_properties
35
+ @_field_set = { "agentId": agent_id, "agentExternalId": agent_external_id, "name": name, "description": description }.reject do | _k, v |
36
+ v == OMIT
37
+ end
38
+ end
39
+ # Deserialize a JSON object to an instance of OrderLineCreate
40
+ #
41
+ # @param json_object [String]
42
+ # @return [Paid::OrderLineCreate]
43
+ def self.from_json(json_object:)
44
+ struct = JSON.parse(json_object, object_class: OpenStruct)
45
+ parsed_json = JSON.parse(json_object)
46
+ agent_id = parsed_json["agentId"]
47
+ agent_external_id = parsed_json["agentExternalId"]
48
+ name = parsed_json["name"]
49
+ description = parsed_json["description"]
50
+ new(
51
+ agent_id: agent_id,
52
+ agent_external_id: agent_external_id,
53
+ name: name,
54
+ description: description,
55
+ additional_properties: struct
56
+ )
57
+ end
58
+ # Serialize an instance of OrderLineCreate to a JSON object
59
+ #
60
+ # @return [String]
61
+ def to_json
62
+ @_field_set&.to_json
63
+ end
64
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
65
+ # hash and check each fields type against the current object's property
66
+ # definitions.
67
+ #
68
+ # @param obj [Object]
69
+ # @return [Void]
70
+ def self.validate_raw(obj:)
71
+ obj.agent_id&.is_a?(String) != false || raise("Passed value for field obj.agent_id is not the expected type, validation failed.")
72
+ obj.agent_external_id&.is_a?(String) != false || raise("Passed value for field obj.agent_external_id is not the expected type, validation failed.")
73
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
74
+ obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+ require_relative "tier"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Paid
7
+ class PricePoint
8
+ # @return [String]
9
+ attr_reader :currency
10
+ # @return [Float]
11
+ attr_reader :unit_price
12
+ # @return [Float]
13
+ attr_reader :min_quantity
14
+ # @return [Array<Paid::Tier>]
15
+ attr_reader :tiers
16
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
17
+ attr_reader :additional_properties
18
+ # @return [Object]
19
+ attr_reader :_field_set
20
+ protected :_field_set
21
+
22
+ OMIT = Object.new
23
+
24
+ # @param currency [String]
25
+ # @param unit_price [Float]
26
+ # @param min_quantity [Float]
27
+ # @param tiers [Array<Paid::Tier>]
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [Paid::PricePoint]
30
+ def initialize(currency: OMIT, unit_price: OMIT, min_quantity: OMIT, tiers: OMIT, additional_properties: nil)
31
+ @currency = currency if currency != OMIT
32
+ @unit_price = unit_price if unit_price != OMIT
33
+ @min_quantity = min_quantity if min_quantity != OMIT
34
+ @tiers = tiers if tiers != OMIT
35
+ @additional_properties = additional_properties
36
+ @_field_set = { "currency": currency, "unitPrice": unit_price, "minQuantity": min_quantity, "tiers": tiers }.reject do | _k, v |
37
+ v == OMIT
38
+ end
39
+ end
40
+ # Deserialize a JSON object to an instance of PricePoint
41
+ #
42
+ # @param json_object [String]
43
+ # @return [Paid::PricePoint]
44
+ def self.from_json(json_object:)
45
+ struct = JSON.parse(json_object, object_class: OpenStruct)
46
+ parsed_json = JSON.parse(json_object)
47
+ currency = parsed_json["currency"]
48
+ unit_price = parsed_json["unitPrice"]
49
+ min_quantity = parsed_json["minQuantity"]
50
+ tiers = parsed_json["tiers"]&.map do | item |
51
+ item = item.to_json
52
+ Paid::Tier.from_json(json_object: item)
53
+ end
54
+ new(
55
+ currency: currency,
56
+ unit_price: unit_price,
57
+ min_quantity: min_quantity,
58
+ tiers: tiers,
59
+ additional_properties: struct
60
+ )
61
+ end
62
+ # Serialize an instance of PricePoint to a JSON object
63
+ #
64
+ # @return [String]
65
+ def to_json
66
+ @_field_set&.to_json
67
+ end
68
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
69
+ # hash and check each fields type against the current object's property
70
+ # definitions.
71
+ #
72
+ # @param obj [Object]
73
+ # @return [Void]
74
+ def self.validate_raw(obj:)
75
+ obj.currency&.is_a?(String) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.")
76
+ obj.unit_price&.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.")
77
+ obj.min_quantity&.is_a?(Float) != false || raise("Passed value for field obj.min_quantity is not the expected type, validation failed.")
78
+ obj.tiers&.is_a?(Array) != false || raise("Passed value for field obj.tiers is not the expected type, validation failed.")
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+ require_relative "charge_type"
3
+ require_relative "pricing_model_type"
4
+ require_relative "billing_frequency"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module Paid
9
+ class Pricing
10
+ # @return [String]
11
+ attr_reader :event_name
12
+ # @return [Boolean]
13
+ attr_reader :taxable
14
+ # @return [Paid::ChargeType]
15
+ attr_reader :charge_type
16
+ # @return [Paid::PricingModelType]
17
+ attr_reader :pricing_model
18
+ # @return [Paid::BillingFrequency]
19
+ attr_reader :billing_frequency
20
+ # @return [Hash{String => Paid::AgentPricePoint}]
21
+ attr_reader :price_points
22
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
23
+ attr_reader :additional_properties
24
+ # @return [Object]
25
+ attr_reader :_field_set
26
+ protected :_field_set
27
+
28
+ OMIT = Object.new
29
+
30
+ # @param event_name [String]
31
+ # @param taxable [Boolean]
32
+ # @param charge_type [Paid::ChargeType]
33
+ # @param pricing_model [Paid::PricingModelType]
34
+ # @param billing_frequency [Paid::BillingFrequency]
35
+ # @param price_points [Hash{String => Paid::AgentPricePoint}]
36
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
37
+ # @return [Paid::Pricing]
38
+ def initialize(event_name: OMIT, taxable:, charge_type:, pricing_model:, billing_frequency:, price_points:, additional_properties: nil)
39
+ @event_name = event_name if event_name != OMIT
40
+ @taxable = taxable
41
+ @charge_type = charge_type
42
+ @pricing_model = pricing_model
43
+ @billing_frequency = billing_frequency
44
+ @price_points = price_points
45
+ @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 |
47
+ v == OMIT
48
+ end
49
+ end
50
+ # Deserialize a JSON object to an instance of Pricing
51
+ #
52
+ # @param json_object [String]
53
+ # @return [Paid::Pricing]
54
+ def self.from_json(json_object:)
55
+ struct = JSON.parse(json_object, object_class: OpenStruct)
56
+ parsed_json = JSON.parse(json_object)
57
+ event_name = parsed_json["eventName"]
58
+ taxable = parsed_json["taxable"]
59
+ charge_type = parsed_json["chargeType"]
60
+ pricing_model = parsed_json["pricingModel"]
61
+ billing_frequency = parsed_json["billingFrequency"]
62
+ price_points = parsed_json["pricePoints"]&.transform_values do | value |
63
+ value = value.to_json
64
+ Paid::AgentPricePoint.from_json(json_object: value)
65
+ end
66
+ new(
67
+ event_name: event_name,
68
+ taxable: taxable,
69
+ charge_type: charge_type,
70
+ pricing_model: pricing_model,
71
+ billing_frequency: billing_frequency,
72
+ price_points: price_points,
73
+ additional_properties: struct
74
+ )
75
+ end
76
+ # Serialize an instance of Pricing to a JSON object
77
+ #
78
+ # @return [String]
79
+ def to_json
80
+ @_field_set&.to_json
81
+ end
82
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
83
+ # hash and check each fields type against the current object's property
84
+ # definitions.
85
+ #
86
+ # @param obj [Object]
87
+ # @return [Void]
88
+ def self.validate_raw(obj:)
89
+ obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.")
90
+ obj.taxable.is_a?(Boolean) != false || raise("Passed value for field obj.taxable is not the expected type, validation failed.")
91
+ obj.charge_type.is_a?(Paid::ChargeType) != false || raise("Passed value for field obj.charge_type is not the expected type, validation failed.")
92
+ obj.pricing_model.is_a?(Paid::PricingModelType) != false || raise("Passed value for field obj.pricing_model is not the expected type, validation failed.")
93
+ obj.billing_frequency.is_a?(Paid::BillingFrequency) != false || raise("Passed value for field obj.billing_frequency is not the expected type, validation failed.")
94
+ obj.price_points.is_a?(Hash) != false || raise("Passed value for field obj.price_points is not the expected type, validation failed.")
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Paid
4
+ class PricingModelType
5
+
6
+ PER_UNIT = "PerUnit"
7
+ VOLUME_PRICING = "VolumePricing"
8
+ GRADUATED_PRICING = "GraduatedPricing"
9
+
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Paid
4
+ class Salutation
5
+
6
+ MR = "Mr."
7
+ MRS = "Mrs."
8
+ MISS = "Miss"
9
+ MS = "Ms."
10
+ DR = "Dr."
11
+ PROF = "Prof."
12
+
13
+ end
14
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Paid
6
+ class Signal
7
+ # @return [String]
8
+ attr_reader :event_name
9
+ # @return [String]
10
+ attr_reader :agent_id
11
+ # @return [String]
12
+ attr_reader :customer_id
13
+ # @return [Hash{String => Object}]
14
+ attr_reader :data
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param event_name [String]
24
+ # @param agent_id [String]
25
+ # @param customer_id [String]
26
+ # @param data [Hash{String => Object}]
27
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
+ # @return [Paid::Signal]
29
+ def initialize(event_name: OMIT, agent_id: OMIT, customer_id: OMIT, data: OMIT, additional_properties: nil)
30
+ @event_name = event_name if event_name != OMIT
31
+ @agent_id = agent_id if agent_id != OMIT
32
+ @customer_id = customer_id if customer_id != OMIT
33
+ @data = data if data != OMIT
34
+ @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 |
36
+ v == OMIT
37
+ end
38
+ end
39
+ # Deserialize a JSON object to an instance of Signal
40
+ #
41
+ # @param json_object [String]
42
+ # @return [Paid::Signal]
43
+ def self.from_json(json_object:)
44
+ struct = JSON.parse(json_object, object_class: OpenStruct)
45
+ parsed_json = JSON.parse(json_object)
46
+ event_name = parsed_json["event_name"]
47
+ agent_id = parsed_json["agent_id"]
48
+ customer_id = parsed_json["customer_id"]
49
+ data = parsed_json["data"]
50
+ new(
51
+ event_name: event_name,
52
+ agent_id: agent_id,
53
+ customer_id: customer_id,
54
+ data: data,
55
+ additional_properties: struct
56
+ )
57
+ end
58
+ # Serialize an instance of Signal to a JSON object
59
+ #
60
+ # @return [String]
61
+ def to_json
62
+ @_field_set&.to_json
63
+ end
64
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
65
+ # hash and check each fields type against the current object's property
66
+ # definitions.
67
+ #
68
+ # @param obj [Object]
69
+ # @return [Void]
70
+ def self.validate_raw(obj:)
71
+ obj.event_name&.is_a?(String) != false || raise("Passed value for field obj.event_name is not the expected type, validation failed.")
72
+ obj.agent_id&.is_a?(String) != false || raise("Passed value for field obj.agent_id is not the expected type, validation failed.")
73
+ obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
74
+ obj.data&.is_a?(Hash) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Paid
4
+ class TaxExemptStatus
5
+
6
+ NONE = "none"
7
+ EXEMPT = "exempt"
8
+ REVERSE = "reverse"
9
+
10
+ end
11
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Paid
6
+ class Tier
7
+ # @return [Float]
8
+ attr_reader :lower_bound
9
+ # @return [Float]
10
+ attr_reader :upper_bound
11
+ # @return [Float]
12
+ attr_reader :price
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param lower_bound [Float]
22
+ # @param upper_bound [Float]
23
+ # @param price [Float]
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [Paid::Tier]
26
+ def initialize(lower_bound: OMIT, upper_bound: OMIT, price: OMIT, additional_properties: nil)
27
+ @lower_bound = lower_bound if lower_bound != OMIT
28
+ @upper_bound = upper_bound if upper_bound != OMIT
29
+ @price = price if price != OMIT
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "lowerBound": lower_bound, "upperBound": upper_bound, "price": price }.reject do | _k, v |
32
+ v == OMIT
33
+ end
34
+ end
35
+ # Deserialize a JSON object to an instance of Tier
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Paid::Tier]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ lower_bound = parsed_json["lowerBound"]
43
+ upper_bound = parsed_json["upperBound"]
44
+ price = parsed_json["price"]
45
+ new(
46
+ lower_bound: lower_bound,
47
+ upper_bound: upper_bound,
48
+ price: price,
49
+ additional_properties: struct
50
+ )
51
+ end
52
+ # Serialize an instance of Tier to a JSON object
53
+ #
54
+ # @return [String]
55
+ def to_json
56
+ @_field_set&.to_json
57
+ end
58
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
59
+ # hash and check each fields type against the current object's property
60
+ # definitions.
61
+ #
62
+ # @param obj [Object]
63
+ # @return [Void]
64
+ def self.validate_raw(obj:)
65
+ obj.lower_bound&.is_a?(Float) != false || raise("Passed value for field obj.lower_bound is not the expected type, validation failed.")
66
+ obj.upper_bound&.is_a?(Float) != false || raise("Passed value for field obj.upper_bound is not the expected type, validation failed.")
67
+ obj.price&.is_a?(Float) != false || raise("Passed value for field obj.price is not the expected type, validation failed.")
68
+ end
69
+ end
70
+ end