splitit-apimatic-sdk 1.0.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 (87) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +154 -0
  4. data/bin/console +15 -0
  5. data/lib/splitit_web_api_v4/api_helper.rb +10 -0
  6. data/lib/splitit_web_api_v4/client.rb +83 -0
  7. data/lib/splitit_web_api_v4/configuration.rb +188 -0
  8. data/lib/splitit_web_api_v4/controllers/base_controller.rb +60 -0
  9. data/lib/splitit_web_api_v4/controllers/installment_plan_controller.rb +242 -0
  10. data/lib/splitit_web_api_v4/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/splitit_web_api_v4/exceptions/api_error_response_exception.rb +51 -0
  12. data/lib/splitit_web_api_v4/exceptions/api_exception.rb +21 -0
  13. data/lib/splitit_web_api_v4/exceptions/o_auth_provider_exception.rb +64 -0
  14. data/lib/splitit_web_api_v4/http/auth/api_key.rb +52 -0
  15. data/lib/splitit_web_api_v4/http/auth/o_auth2.rb +156 -0
  16. data/lib/splitit_web_api_v4/http/http_call_back.rb +10 -0
  17. data/lib/splitit_web_api_v4/http/http_method_enum.rb +10 -0
  18. data/lib/splitit_web_api_v4/http/http_request.rb +10 -0
  19. data/lib/splitit_web_api_v4/http/http_response.rb +10 -0
  20. data/lib/splitit_web_api_v4/http/proxy_settings.rb +22 -0
  21. data/lib/splitit_web_api_v4/models/amount_data.rb +70 -0
  22. data/lib/splitit_web_api_v4/models/api_error_model.rb +93 -0
  23. data/lib/splitit_web_api_v4/models/apr_data.rb +70 -0
  24. data/lib/splitit_web_api_v4/models/authorization_status_enum.rb +40 -0
  25. data/lib/splitit_web_api_v4/models/authorize_authorization_data.rb +154 -0
  26. data/lib/splitit_web_api_v4/models/authorize_request.rb +115 -0
  27. data/lib/splitit_web_api_v4/models/authorize_response.rb +221 -0
  28. data/lib/splitit_web_api_v4/models/base_model.rb +110 -0
  29. data/lib/splitit_web_api_v4/models/billing_address_data.rb +111 -0
  30. data/lib/splitit_web_api_v4/models/card_details.rb +108 -0
  31. data/lib/splitit_web_api_v4/models/card_validity_request.rb +62 -0
  32. data/lib/splitit_web_api_v4/models/card_validity_response.rb +80 -0
  33. data/lib/splitit_web_api_v4/models/checkout_url_data.rb +80 -0
  34. data/lib/splitit_web_api_v4/models/content_segment.rb +90 -0
  35. data/lib/splitit_web_api_v4/models/external_provider_types_enum.rb +48 -0
  36. data/lib/splitit_web_api_v4/models/inline_content.rb +71 -0
  37. data/lib/splitit_web_api_v4/models/installment_item.rb +101 -0
  38. data/lib/splitit_web_api_v4/models/installment_plan_details_response.rb +280 -0
  39. data/lib/splitit_web_api_v4/models/installment_plan_search_details_response.rb +71 -0
  40. data/lib/splitit_web_api_v4/models/installment_plan_search_request.rb +79 -0
  41. data/lib/splitit_web_api_v4/models/installment_plan_status_enum.rb +72 -0
  42. data/lib/splitit_web_api_v4/models/installment_status_enum.rb +60 -0
  43. data/lib/splitit_web_api_v4/models/masked_card_details.rb +82 -0
  44. data/lib/splitit_web_api_v4/models/metadata_item.rb +71 -0
  45. data/lib/splitit_web_api_v4/models/o_auth_provider_error_enum.rb +62 -0
  46. data/lib/splitit_web_api_v4/models/o_auth_scope_o_auth2_enum.rb +26 -0
  47. data/lib/splitit_web_api_v4/models/o_auth_token.rb +96 -0
  48. data/lib/splitit_web_api_v4/models/offer_item.rb +164 -0
  49. data/lib/splitit_web_api_v4/models/offers_billing_address.rb +108 -0
  50. data/lib/splitit_web_api_v4/models/offers_card_details.rb +108 -0
  51. data/lib/splitit_web_api_v4/models/offers_merchant_details.rb +82 -0
  52. data/lib/splitit_web_api_v4/models/offers_payment_method.rb +66 -0
  53. data/lib/splitit_web_api_v4/models/offers_payment_method_response.rb +88 -0
  54. data/lib/splitit_web_api_v4/models/offers_request.rb +145 -0
  55. data/lib/splitit_web_api_v4/models/offers_response.rb +156 -0
  56. data/lib/splitit_web_api_v4/models/offers_shopper_details.rb +112 -0
  57. data/lib/splitit_web_api_v4/models/offers_store_location.rb +108 -0
  58. data/lib/splitit_web_api_v4/models/payment_link_request.rb +195 -0
  59. data/lib/splitit_web_api_v4/models/payment_link_response.rb +107 -0
  60. data/lib/splitit_web_api_v4/models/payment_method.rb +66 -0
  61. data/lib/splitit_web_api_v4/models/payment_method_data.rb +78 -0
  62. data/lib/splitit_web_api_v4/models/payment_method_type_enum.rb +26 -0
  63. data/lib/splitit_web_api_v4/models/pis_error_codes_enum.rb +1021 -0
  64. data/lib/splitit_web_api_v4/models/plan_authorization_data.rb +172 -0
  65. data/lib/splitit_web_api_v4/models/plan_links_data.rb +91 -0
  66. data/lib/splitit_web_api_v4/models/plan_status_enum.rb +48 -0
  67. data/lib/splitit_web_api_v4/models/processing_data.rb +63 -0
  68. data/lib/splitit_web_api_v4/models/purchase_method_enum.rb +52 -0
  69. data/lib/splitit_web_api_v4/models/redirect_urls.rb +81 -0
  70. data/lib/splitit_web_api_v4/models/refund_item.rb +136 -0
  71. data/lib/splitit_web_api_v4/models/refund_request.rb +70 -0
  72. data/lib/splitit_web_api_v4/models/refund_response.rb +105 -0
  73. data/lib/splitit_web_api_v4/models/shipping_status_enum.rb +40 -0
  74. data/lib/splitit_web_api_v4/models/shopper_details_data.rb +113 -0
  75. data/lib/splitit_web_api_v4/models/three_ds_authentication_data.rb +90 -0
  76. data/lib/splitit_web_api_v4/models/three_ds_execute.rb +62 -0
  77. data/lib/splitit_web_api_v4/models/three_ds_redirect_data.rb +93 -0
  78. data/lib/splitit_web_api_v4/models/three_ds_request_data.rb +84 -0
  79. data/lib/splitit_web_api_v4/models/update_offers_payment_method.rb +66 -0
  80. data/lib/splitit_web_api_v4/models/update_offers_request.rb +105 -0
  81. data/lib/splitit_web_api_v4/models/update_order_request.rb +104 -0
  82. data/lib/splitit_web_api_v4/models/update_order_response.rb +126 -0
  83. data/lib/splitit_web_api_v4/models/validation_error.rb +71 -0
  84. data/lib/splitit_web_api_v4/utilities/date_time_helper.rb +11 -0
  85. data/lib/splitit_web_api_v4/utilities/file_wrapper.rb +28 -0
  86. data/lib/splitit_web_api_v4.rb +108 -0
  87. metadata +170 -0
@@ -0,0 +1,145 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OffersRequest Model.
8
+ class OffersRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :merchant_order_reference
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [PurchaseMethodEnum]
18
+ attr_accessor :purchase_method
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :purchase_amount
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :currency
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [OffersShopperDetails]
30
+ attr_accessor :shopper_details
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [OffersPaymentMethod]
34
+ attr_accessor :payment_method
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [OffersMerchantDetails]
38
+ attr_accessor :merchant_details
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [Array[MetadataItem]]
42
+ attr_accessor :metadata
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['merchant_order_reference'] = 'MerchantOrderReference'
48
+ @_hash['purchase_method'] = 'PurchaseMethod'
49
+ @_hash['purchase_amount'] = 'PurchaseAmount'
50
+ @_hash['currency'] = 'Currency'
51
+ @_hash['shopper_details'] = 'ShopperDetails'
52
+ @_hash['payment_method'] = 'PaymentMethod'
53
+ @_hash['merchant_details'] = 'MerchantDetails'
54
+ @_hash['metadata'] = 'Metadata'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ merchant_order_reference
62
+ merchant_details
63
+ metadata
64
+ ]
65
+ end
66
+
67
+ # An array for nullable fields
68
+ def self.nullables
69
+ []
70
+ end
71
+
72
+ def initialize(purchase_method = nil, purchase_amount = nil, currency = nil,
73
+ shopper_details = nil, payment_method = nil,
74
+ merchant_order_reference = SKIP, merchant_details = SKIP,
75
+ metadata = SKIP)
76
+ @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
77
+ @purchase_method = purchase_method
78
+ @purchase_amount = purchase_amount
79
+ @currency = currency
80
+ @shopper_details = shopper_details
81
+ @payment_method = payment_method
82
+ @merchant_details = merchant_details unless merchant_details == SKIP
83
+ @metadata = metadata unless metadata == SKIP
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ purchase_method =
92
+ hash.key?('PurchaseMethod') ? hash['PurchaseMethod'] : nil
93
+ purchase_amount =
94
+ hash.key?('PurchaseAmount') ? hash['PurchaseAmount'] : nil
95
+ currency = hash.key?('Currency') ? hash['Currency'] : nil
96
+ shopper_details = OffersShopperDetails.from_hash(hash['ShopperDetails']) if
97
+ hash['ShopperDetails']
98
+ payment_method = OffersPaymentMethod.from_hash(hash['PaymentMethod']) if
99
+ hash['PaymentMethod']
100
+ merchant_order_reference =
101
+ hash.key?('MerchantOrderReference') ? hash['MerchantOrderReference'] : SKIP
102
+ merchant_details = OffersMerchantDetails.from_hash(hash['MerchantDetails']) if
103
+ hash['MerchantDetails']
104
+ # Parameter is an array, so we need to iterate through it
105
+ metadata = nil
106
+ unless hash['Metadata'].nil?
107
+ metadata = []
108
+ hash['Metadata'].each do |structure|
109
+ metadata << (MetadataItem.from_hash(structure) if structure)
110
+ end
111
+ end
112
+
113
+ metadata = SKIP unless hash.key?('Metadata')
114
+
115
+ # Create object from extracted values.
116
+ OffersRequest.new(purchase_method,
117
+ purchase_amount,
118
+ currency,
119
+ shopper_details,
120
+ payment_method,
121
+ merchant_order_reference,
122
+ merchant_details,
123
+ metadata)
124
+ end
125
+
126
+ # Provides a human-readable string representation of the object.
127
+ def to_s
128
+ class_name = self.class.name.split('::').last
129
+ "<#{class_name} merchant_order_reference: #{@merchant_order_reference}, purchase_method:"\
130
+ " #{@purchase_method}, purchase_amount: #{@purchase_amount}, currency: #{@currency},"\
131
+ " shopper_details: #{@shopper_details}, payment_method: #{@payment_method},"\
132
+ " merchant_details: #{@merchant_details}, metadata: #{@metadata}>"
133
+ end
134
+
135
+ # Provides a debugging-friendly string with detailed object information.
136
+ def inspect
137
+ class_name = self.class.name.split('::').last
138
+ "<#{class_name} merchant_order_reference: #{@merchant_order_reference.inspect},"\
139
+ " purchase_method: #{@purchase_method.inspect}, purchase_amount:"\
140
+ " #{@purchase_amount.inspect}, currency: #{@currency.inspect}, shopper_details:"\
141
+ " #{@shopper_details.inspect}, payment_method: #{@payment_method.inspect}, merchant_details:"\
142
+ " #{@merchant_details.inspect}, metadata: #{@metadata.inspect}>"
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,156 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module SplititWebApiV4
8
+ # OffersResponse Model.
9
+ class OffersResponse < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :installment_plan_number
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :merchant_order_reference
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [PurchaseMethodEnum]
23
+ attr_accessor :purchase_method
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [Float]
27
+ attr_accessor :purchase_amount
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :currency
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [OffersPaymentMethodResponse]
35
+ attr_accessor :payment_method
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [Array[OfferItem]]
39
+ attr_accessor :offers
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [DateTime]
43
+ attr_accessor :valid_until
44
+
45
+ # A mapping from model property names to API property names.
46
+ def self.names
47
+ @_hash = {} if @_hash.nil?
48
+ @_hash['installment_plan_number'] = 'InstallmentPlanNumber'
49
+ @_hash['merchant_order_reference'] = 'MerchantOrderReference'
50
+ @_hash['purchase_method'] = 'PurchaseMethod'
51
+ @_hash['purchase_amount'] = 'PurchaseAmount'
52
+ @_hash['currency'] = 'Currency'
53
+ @_hash['payment_method'] = 'PaymentMethod'
54
+ @_hash['offers'] = 'Offers'
55
+ @_hash['valid_until'] = 'ValidUntil'
56
+ @_hash
57
+ end
58
+
59
+ # An array for optional fields
60
+ def self.optionals
61
+ %w[
62
+ installment_plan_number
63
+ merchant_order_reference
64
+ currency
65
+ payment_method
66
+ offers
67
+ valid_until
68
+ ]
69
+ end
70
+
71
+ # An array for nullable fields
72
+ def self.nullables
73
+ []
74
+ end
75
+
76
+ def initialize(purchase_method = nil, purchase_amount = nil,
77
+ installment_plan_number = SKIP,
78
+ merchant_order_reference = SKIP, currency = SKIP,
79
+ payment_method = SKIP, offers = SKIP, valid_until = SKIP)
80
+ @installment_plan_number = installment_plan_number unless installment_plan_number == SKIP
81
+ @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
82
+ @purchase_method = purchase_method
83
+ @purchase_amount = purchase_amount
84
+ @currency = currency unless currency == SKIP
85
+ @payment_method = payment_method unless payment_method == SKIP
86
+ @offers = offers unless offers == SKIP
87
+ @valid_until = valid_until unless valid_until == SKIP
88
+ end
89
+
90
+ # Creates an instance of the object from a hash.
91
+ def self.from_hash(hash)
92
+ return nil unless hash
93
+
94
+ # Extract variables from the hash.
95
+ purchase_method =
96
+ hash.key?('PurchaseMethod') ? hash['PurchaseMethod'] : nil
97
+ purchase_amount =
98
+ hash.key?('PurchaseAmount') ? hash['PurchaseAmount'] : nil
99
+ installment_plan_number =
100
+ hash.key?('InstallmentPlanNumber') ? hash['InstallmentPlanNumber'] : SKIP
101
+ merchant_order_reference =
102
+ hash.key?('MerchantOrderReference') ? hash['MerchantOrderReference'] : SKIP
103
+ currency = hash.key?('Currency') ? hash['Currency'] : SKIP
104
+ payment_method = OffersPaymentMethodResponse.from_hash(hash['PaymentMethod']) if
105
+ hash['PaymentMethod']
106
+ # Parameter is an array, so we need to iterate through it
107
+ offers = nil
108
+ unless hash['Offers'].nil?
109
+ offers = []
110
+ hash['Offers'].each do |structure|
111
+ offers << (OfferItem.from_hash(structure) if structure)
112
+ end
113
+ end
114
+
115
+ offers = SKIP unless hash.key?('Offers')
116
+ valid_until = if hash.key?('ValidUntil')
117
+ (DateTimeHelper.from_rfc3339(hash['ValidUntil']) if hash['ValidUntil'])
118
+ else
119
+ SKIP
120
+ end
121
+
122
+ # Create object from extracted values.
123
+ OffersResponse.new(purchase_method,
124
+ purchase_amount,
125
+ installment_plan_number,
126
+ merchant_order_reference,
127
+ currency,
128
+ payment_method,
129
+ offers,
130
+ valid_until)
131
+ end
132
+
133
+ def to_custom_valid_until
134
+ DateTimeHelper.to_rfc3339(valid_until)
135
+ end
136
+
137
+ # Provides a human-readable string representation of the object.
138
+ def to_s
139
+ class_name = self.class.name.split('::').last
140
+ "<#{class_name} installment_plan_number: #{@installment_plan_number},"\
141
+ " merchant_order_reference: #{@merchant_order_reference}, purchase_method:"\
142
+ " #{@purchase_method}, purchase_amount: #{@purchase_amount}, currency: #{@currency},"\
143
+ " payment_method: #{@payment_method}, offers: #{@offers}, valid_until: #{@valid_until}>"
144
+ end
145
+
146
+ # Provides a debugging-friendly string with detailed object information.
147
+ def inspect
148
+ class_name = self.class.name.split('::').last
149
+ "<#{class_name} installment_plan_number: #{@installment_plan_number.inspect},"\
150
+ " merchant_order_reference: #{@merchant_order_reference.inspect}, purchase_method:"\
151
+ " #{@purchase_method.inspect}, purchase_amount: #{@purchase_amount.inspect}, currency:"\
152
+ " #{@currency.inspect}, payment_method: #{@payment_method.inspect}, offers:"\
153
+ " #{@offers.inspect}, valid_until: #{@valid_until.inspect}>"
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,112 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OffersShopperDetails Model.
8
+ class OffersShopperDetails < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :first_name
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :last_name
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :email
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :phone_number
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :shopper_locale
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [OffersBillingAddress]
34
+ attr_accessor :billing_address
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['first_name'] = 'FirstName'
40
+ @_hash['last_name'] = 'LastName'
41
+ @_hash['email'] = 'Email'
42
+ @_hash['phone_number'] = 'PhoneNumber'
43
+ @_hash['shopper_locale'] = 'ShopperLocale'
44
+ @_hash['billing_address'] = 'BillingAddress'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ first_name
52
+ phone_number
53
+ shopper_locale
54
+ billing_address
55
+ ]
56
+ end
57
+
58
+ # An array for nullable fields
59
+ def self.nullables
60
+ []
61
+ end
62
+
63
+ def initialize(last_name = nil, email = nil, first_name = SKIP,
64
+ phone_number = SKIP, shopper_locale = SKIP,
65
+ billing_address = SKIP)
66
+ @first_name = first_name unless first_name == SKIP
67
+ @last_name = last_name
68
+ @email = email
69
+ @phone_number = phone_number unless phone_number == SKIP
70
+ @shopper_locale = shopper_locale unless shopper_locale == SKIP
71
+ @billing_address = billing_address unless billing_address == SKIP
72
+ end
73
+
74
+ # Creates an instance of the object from a hash.
75
+ def self.from_hash(hash)
76
+ return nil unless hash
77
+
78
+ # Extract variables from the hash.
79
+ last_name = hash.key?('LastName') ? hash['LastName'] : nil
80
+ email = hash.key?('Email') ? hash['Email'] : nil
81
+ first_name = hash.key?('FirstName') ? hash['FirstName'] : SKIP
82
+ phone_number = hash.key?('PhoneNumber') ? hash['PhoneNumber'] : SKIP
83
+ shopper_locale = hash.key?('ShopperLocale') ? hash['ShopperLocale'] : SKIP
84
+ billing_address = OffersBillingAddress.from_hash(hash['BillingAddress']) if
85
+ hash['BillingAddress']
86
+
87
+ # Create object from extracted values.
88
+ OffersShopperDetails.new(last_name,
89
+ email,
90
+ first_name,
91
+ phone_number,
92
+ shopper_locale,
93
+ billing_address)
94
+ end
95
+
96
+ # Provides a human-readable string representation of the object.
97
+ def to_s
98
+ class_name = self.class.name.split('::').last
99
+ "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, email: #{@email},"\
100
+ " phone_number: #{@phone_number}, shopper_locale: #{@shopper_locale}, billing_address:"\
101
+ " #{@billing_address}>"
102
+ end
103
+
104
+ # Provides a debugging-friendly string with detailed object information.
105
+ def inspect
106
+ class_name = self.class.name.split('::').last
107
+ "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
108
+ " email: #{@email.inspect}, phone_number: #{@phone_number.inspect}, shopper_locale:"\
109
+ " #{@shopper_locale.inspect}, billing_address: #{@billing_address.inspect}>"
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,108 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # OffersStoreLocation Model.
8
+ class OffersStoreLocation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :line1
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :line2
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :city
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :state
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :postal_code
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :country
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['line1'] = 'Line1'
40
+ @_hash['line2'] = 'Line2'
41
+ @_hash['city'] = 'City'
42
+ @_hash['state'] = 'State'
43
+ @_hash['postal_code'] = 'PostalCode'
44
+ @_hash['country'] = 'Country'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ line2
52
+ city
53
+ state
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ []
60
+ end
61
+
62
+ def initialize(line1 = nil, postal_code = nil, country = nil, line2 = SKIP,
63
+ city = SKIP, state = SKIP)
64
+ @line1 = line1
65
+ @line2 = line2 unless line2 == SKIP
66
+ @city = city unless city == SKIP
67
+ @state = state unless state == SKIP
68
+ @postal_code = postal_code
69
+ @country = country
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ line1 = hash.key?('Line1') ? hash['Line1'] : nil
78
+ postal_code = hash.key?('PostalCode') ? hash['PostalCode'] : nil
79
+ country = hash.key?('Country') ? hash['Country'] : nil
80
+ line2 = hash.key?('Line2') ? hash['Line2'] : SKIP
81
+ city = hash.key?('City') ? hash['City'] : SKIP
82
+ state = hash.key?('State') ? hash['State'] : SKIP
83
+
84
+ # Create object from extracted values.
85
+ OffersStoreLocation.new(line1,
86
+ postal_code,
87
+ country,
88
+ line2,
89
+ city,
90
+ state)
91
+ end
92
+
93
+ # Provides a human-readable string representation of the object.
94
+ def to_s
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} line1: #{@line1}, line2: #{@line2}, city: #{@city}, state: #{@state},"\
97
+ " postal_code: #{@postal_code}, country: #{@country}>"
98
+ end
99
+
100
+ # Provides a debugging-friendly string with detailed object information.
101
+ def inspect
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} line1: #{@line1.inspect}, line2: #{@line2.inspect}, city: #{@city.inspect},"\
104
+ " state: #{@state.inspect}, postal_code: #{@postal_code.inspect}, country:"\
105
+ " #{@country.inspect}>"
106
+ end
107
+ end
108
+ end