loyalty-sdk 0.0.1
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 +7 -0
- data/LICENSE +28 -0
- data/README.md +187 -0
- data/bin/console +15 -0
- data/lib/loyalty_ap_is/api_helper.rb +10 -0
- data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
- data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
- data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
- data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
- data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
- data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
- data/lib/loyalty_ap_is/client.rb +137 -0
- data/lib/loyalty_ap_is/configuration.rb +238 -0
- data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
- data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/http/api_response.rb +19 -0
- data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
- data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
- data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
- data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
- data/lib/loyalty_ap_is/http/http_request.rb +10 -0
- data/lib/loyalty_ap_is/http/http_response.rb +10 -0
- data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
- data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
- data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
- data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
- data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
- data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
- data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
- data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
- data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
- data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
- data/lib/loyalty_ap_is/models/base_model.rb +110 -0
- data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
- data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
- data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
- data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
- data/lib/loyalty_ap_is/models/error_info.rb +84 -0
- data/lib/loyalty_ap_is/models/error_item.rb +105 -0
- data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
- data/lib/loyalty_ap_is/models/error_source.rb +75 -0
- data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
- data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
- data/lib/loyalty_ap_is/models/fault.rb +85 -0
- data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
- data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
- data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
- data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
- data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
- data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
- data/lib/loyalty_ap_is/models/offer.rb +155 -0
- data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
- data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
- data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
- data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
- data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
- data/lib/loyalty_ap_is/models/product_type.rb +53 -0
- data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
- data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
- data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
- data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
- data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
- data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
- data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
- data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
- data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
- data/lib/loyalty_ap_is/models/site_data.rb +121 -0
- data/lib/loyalty_ap_is/models/transaction.rb +351 -0
- data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
- data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
- data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
- data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
- data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
- data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
- data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
- data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
- data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
- data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
- data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
- data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/loyalty_ap_is.rb +128 -0
- metadata +189 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# RedemptionResponseItem Model.
|
|
8
|
+
class RedemptionResponseItem < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Unique Item ID for the transaction from the partner. Used to identify the
|
|
13
|
+
# catalogue item in the Shell Loyalty Platform. Each Partner will have one
|
|
14
|
+
# or more items set up in the Shell Loyalty Platform.
|
|
15
|
+
# @return [String]
|
|
16
|
+
attr_accessor :item_id
|
|
17
|
+
|
|
18
|
+
# The quantity of the items required.
|
|
19
|
+
# @return [Integer]
|
|
20
|
+
attr_accessor :quantity
|
|
21
|
+
|
|
22
|
+
# The number of points that will be redemmed from the Shell Loyalty
|
|
23
|
+
# Platform.
|
|
24
|
+
# @return [Integer]
|
|
25
|
+
attr_accessor :points
|
|
26
|
+
|
|
27
|
+
# The reason for the points redemption. This attribute will be shown in the
|
|
28
|
+
# Transaction History feture.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :reason_for_redemption
|
|
31
|
+
|
|
32
|
+
# A mapping from model property names to API property names.
|
|
33
|
+
def self.names
|
|
34
|
+
@_hash = {} if @_hash.nil?
|
|
35
|
+
@_hash['item_id'] = 'itemId'
|
|
36
|
+
@_hash['quantity'] = 'quantity'
|
|
37
|
+
@_hash['points'] = 'points'
|
|
38
|
+
@_hash['reason_for_redemption'] = 'reasonForRedemption'
|
|
39
|
+
@_hash
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# An array for optional fields
|
|
43
|
+
def self.optionals
|
|
44
|
+
%w[
|
|
45
|
+
item_id
|
|
46
|
+
quantity
|
|
47
|
+
points
|
|
48
|
+
reason_for_redemption
|
|
49
|
+
]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# An array for nullable fields
|
|
53
|
+
def self.nullables
|
|
54
|
+
[]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(item_id: SKIP, quantity: SKIP, points: SKIP,
|
|
58
|
+
reason_for_redemption: SKIP, additional_properties: nil)
|
|
59
|
+
# Add additional model properties to the instance
|
|
60
|
+
additional_properties = {} if additional_properties.nil?
|
|
61
|
+
|
|
62
|
+
@item_id = item_id unless item_id == SKIP
|
|
63
|
+
@quantity = quantity unless quantity == SKIP
|
|
64
|
+
@points = points unless points == SKIP
|
|
65
|
+
@reason_for_redemption = reason_for_redemption unless reason_for_redemption == SKIP
|
|
66
|
+
@additional_properties = additional_properties
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Creates an instance of the object from a hash.
|
|
70
|
+
def self.from_hash(hash)
|
|
71
|
+
return nil unless hash
|
|
72
|
+
|
|
73
|
+
# Extract variables from the hash.
|
|
74
|
+
item_id = hash.key?('itemId') ? hash['itemId'] : SKIP
|
|
75
|
+
quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
|
|
76
|
+
points = hash.key?('points') ? hash['points'] : SKIP
|
|
77
|
+
reason_for_redemption =
|
|
78
|
+
hash.key?('reasonForRedemption') ? hash['reasonForRedemption'] : SKIP
|
|
79
|
+
|
|
80
|
+
# Create a new hash for additional properties, removing known properties.
|
|
81
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
82
|
+
|
|
83
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
84
|
+
new_hash, proc { |value| value }
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
# Create object from extracted values.
|
|
88
|
+
RedemptionResponseItem.new(item_id: item_id,
|
|
89
|
+
quantity: quantity,
|
|
90
|
+
points: points,
|
|
91
|
+
reason_for_redemption: reason_for_redemption,
|
|
92
|
+
additional_properties: additional_properties)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Provides a human-readable string representation of the object.
|
|
96
|
+
def to_s
|
|
97
|
+
class_name = self.class.name.split('::').last
|
|
98
|
+
"<#{class_name} item_id: #{@item_id}, quantity: #{@quantity}, points: #{@points},"\
|
|
99
|
+
" reason_for_redemption: #{@reason_for_redemption}, additional_properties:"\
|
|
100
|
+
" #{@additional_properties}>"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
104
|
+
def inspect
|
|
105
|
+
class_name = self.class.name.split('::').last
|
|
106
|
+
"<#{class_name} item_id: #{@item_id.inspect}, quantity: #{@quantity.inspect}, points:"\
|
|
107
|
+
" #{@points.inspect}, reason_for_redemption: #{@reason_for_redemption.inspect},"\
|
|
108
|
+
" additional_properties: #{@additional_properties}>"
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# RefreshTokenRequest Model.
|
|
8
|
+
class RefreshTokenRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The refresh token which was provided from the exchangeAccessCode end
|
|
13
|
+
# point.
|
|
14
|
+
# @return [String]
|
|
15
|
+
attr_accessor :refresh_token
|
|
16
|
+
|
|
17
|
+
# A mapping from model property names to API property names.
|
|
18
|
+
def self.names
|
|
19
|
+
@_hash = {} if @_hash.nil?
|
|
20
|
+
@_hash['refresh_token'] = 'refreshToken'
|
|
21
|
+
@_hash
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# An array for optional fields
|
|
25
|
+
def self.optionals
|
|
26
|
+
[]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# An array for nullable fields
|
|
30
|
+
def self.nullables
|
|
31
|
+
[]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize(refresh_token:, additional_properties: nil)
|
|
35
|
+
# Add additional model properties to the instance
|
|
36
|
+
additional_properties = {} if additional_properties.nil?
|
|
37
|
+
|
|
38
|
+
@refresh_token = refresh_token
|
|
39
|
+
@additional_properties = additional_properties
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Creates an instance of the object from a hash.
|
|
43
|
+
def self.from_hash(hash)
|
|
44
|
+
return nil unless hash
|
|
45
|
+
|
|
46
|
+
# Extract variables from the hash.
|
|
47
|
+
refresh_token = hash.key?('refreshToken') ? hash['refreshToken'] : nil
|
|
48
|
+
|
|
49
|
+
# Create a new hash for additional properties, removing known properties.
|
|
50
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
51
|
+
|
|
52
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
53
|
+
new_hash, proc { |value| value }
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Create object from extracted values.
|
|
57
|
+
RefreshTokenRequest.new(refresh_token: refresh_token,
|
|
58
|
+
additional_properties: additional_properties)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Provides a human-readable string representation of the object.
|
|
62
|
+
def to_s
|
|
63
|
+
class_name = self.class.name.split('::').last
|
|
64
|
+
"<#{class_name} refresh_token: #{@refresh_token}, additional_properties:"\
|
|
65
|
+
" #{@additional_properties}>"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
69
|
+
def inspect
|
|
70
|
+
class_name = self.class.name.split('::').last
|
|
71
|
+
"<#{class_name} refresh_token: #{@refresh_token.inspect}, additional_properties:"\
|
|
72
|
+
" #{@additional_properties}>"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# RefreshTokenResponse Model.
|
|
8
|
+
class RefreshTokenResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :access_token
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :refresh_token
|
|
19
|
+
|
|
20
|
+
# Indicates the number of seconds until the new access token provided in the
|
|
21
|
+
# pair expires
|
|
22
|
+
# @return [Integer]
|
|
23
|
+
attr_accessor :expires_in
|
|
24
|
+
|
|
25
|
+
# A mapping from model property names to API property names.
|
|
26
|
+
def self.names
|
|
27
|
+
@_hash = {} if @_hash.nil?
|
|
28
|
+
@_hash['access_token'] = 'accessToken'
|
|
29
|
+
@_hash['refresh_token'] = 'refreshToken'
|
|
30
|
+
@_hash['expires_in'] = 'expiresIn'
|
|
31
|
+
@_hash
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# An array for optional fields
|
|
35
|
+
def self.optionals
|
|
36
|
+
[]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# An array for nullable fields
|
|
40
|
+
def self.nullables
|
|
41
|
+
[]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def initialize(access_token:, refresh_token:, expires_in:,
|
|
45
|
+
additional_properties: nil)
|
|
46
|
+
# Add additional model properties to the instance
|
|
47
|
+
additional_properties = {} if additional_properties.nil?
|
|
48
|
+
|
|
49
|
+
@access_token = access_token
|
|
50
|
+
@refresh_token = refresh_token
|
|
51
|
+
@expires_in = expires_in
|
|
52
|
+
@additional_properties = additional_properties
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Creates an instance of the object from a hash.
|
|
56
|
+
def self.from_hash(hash)
|
|
57
|
+
return nil unless hash
|
|
58
|
+
|
|
59
|
+
# Extract variables from the hash.
|
|
60
|
+
access_token = hash.key?('accessToken') ? hash['accessToken'] : nil
|
|
61
|
+
refresh_token = hash.key?('refreshToken') ? hash['refreshToken'] : nil
|
|
62
|
+
expires_in = hash.key?('expiresIn') ? hash['expiresIn'] : nil
|
|
63
|
+
|
|
64
|
+
# Create a new hash for additional properties, removing known properties.
|
|
65
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
66
|
+
|
|
67
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
68
|
+
new_hash, proc { |value| value }
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Create object from extracted values.
|
|
72
|
+
RefreshTokenResponse.new(access_token: access_token,
|
|
73
|
+
refresh_token: refresh_token,
|
|
74
|
+
expires_in: expires_in,
|
|
75
|
+
additional_properties: additional_properties)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Provides a human-readable string representation of the object.
|
|
79
|
+
def to_s
|
|
80
|
+
class_name = self.class.name.split('::').last
|
|
81
|
+
"<#{class_name} access_token: #{@access_token}, refresh_token: #{@refresh_token},"\
|
|
82
|
+
" expires_in: #{@expires_in}, additional_properties: #{@additional_properties}>"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
86
|
+
def inspect
|
|
87
|
+
class_name = self.class.name.split('::').last
|
|
88
|
+
"<#{class_name} access_token: #{@access_token.inspect}, refresh_token:"\
|
|
89
|
+
" #{@refresh_token.inspect}, expires_in: #{@expires_in.inspect}, additional_properties:"\
|
|
90
|
+
" #{@additional_properties}>"
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# SaleItem Model.
|
|
8
|
+
class SaleItem < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Description - currently not in use
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :description
|
|
15
|
+
|
|
16
|
+
# Total amount
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :amount
|
|
19
|
+
|
|
20
|
+
# Indicates the Type of the transaction detail row (award, redemption,
|
|
21
|
+
# transfer, voucher, refund or central award).
|
|
22
|
+
# @return [TransactionDetailType]
|
|
23
|
+
attr_accessor :detail_type
|
|
24
|
+
|
|
25
|
+
# Discount amount of sales line
|
|
26
|
+
# @return [Float]
|
|
27
|
+
attr_accessor :discount_amount
|
|
28
|
+
|
|
29
|
+
# Discount amount of sales line
|
|
30
|
+
# @return [Array[OfferInfo]]
|
|
31
|
+
attr_accessor :offer_infos
|
|
32
|
+
|
|
33
|
+
# Discount amount of sales line
|
|
34
|
+
# @return [OfferLanguage]
|
|
35
|
+
attr_accessor :offer_lang
|
|
36
|
+
|
|
37
|
+
# Original amount of sales line
|
|
38
|
+
# @return [Float]
|
|
39
|
+
attr_accessor :original_amount
|
|
40
|
+
|
|
41
|
+
# Original amount excluding VAT
|
|
42
|
+
# @return [Float]
|
|
43
|
+
attr_accessor :original_net_amount
|
|
44
|
+
|
|
45
|
+
# Original amount excluding VAT
|
|
46
|
+
# @return [SaleItemProduct]
|
|
47
|
+
attr_accessor :product_data
|
|
48
|
+
|
|
49
|
+
# Quantity of product
|
|
50
|
+
# @return [Float]
|
|
51
|
+
attr_accessor :quantity
|
|
52
|
+
|
|
53
|
+
# Value added tax
|
|
54
|
+
# @return [Float]
|
|
55
|
+
attr_accessor :vat_amount
|
|
56
|
+
|
|
57
|
+
# VAT rate of sales line
|
|
58
|
+
# @return [Float]
|
|
59
|
+
attr_accessor :vat_rate
|
|
60
|
+
|
|
61
|
+
# VAT rate of sales line
|
|
62
|
+
# @return [Array[VoucherItem]]
|
|
63
|
+
attr_accessor :voucher_items
|
|
64
|
+
|
|
65
|
+
# List of vouchers
|
|
66
|
+
# @return [Array[String]]
|
|
67
|
+
attr_accessor :vouchers
|
|
68
|
+
|
|
69
|
+
# Unit price of sale item
|
|
70
|
+
# @return [Float]
|
|
71
|
+
attr_accessor :unit_price
|
|
72
|
+
|
|
73
|
+
# Unit of measure
|
|
74
|
+
# @return [UnitMeasure]
|
|
75
|
+
attr_accessor :unit_measure
|
|
76
|
+
|
|
77
|
+
# Unit of measure
|
|
78
|
+
# @return [EvChargingDetails]
|
|
79
|
+
attr_accessor :ev
|
|
80
|
+
|
|
81
|
+
# Points earned in a transaction
|
|
82
|
+
# @return [Integer]
|
|
83
|
+
attr_accessor :points
|
|
84
|
+
|
|
85
|
+
# A mapping from model property names to API property names.
|
|
86
|
+
def self.names
|
|
87
|
+
@_hash = {} if @_hash.nil?
|
|
88
|
+
@_hash['description'] = 'description'
|
|
89
|
+
@_hash['amount'] = 'amount'
|
|
90
|
+
@_hash['detail_type'] = 'detailType'
|
|
91
|
+
@_hash['discount_amount'] = 'discountAmount'
|
|
92
|
+
@_hash['offer_infos'] = 'offerInfos'
|
|
93
|
+
@_hash['offer_lang'] = 'offerLang'
|
|
94
|
+
@_hash['original_amount'] = 'originalAmount'
|
|
95
|
+
@_hash['original_net_amount'] = 'originalNetAmount'
|
|
96
|
+
@_hash['product_data'] = 'productData'
|
|
97
|
+
@_hash['quantity'] = 'quantity'
|
|
98
|
+
@_hash['vat_amount'] = 'vatAmount'
|
|
99
|
+
@_hash['vat_rate'] = 'vatRate'
|
|
100
|
+
@_hash['voucher_items'] = 'voucherItems'
|
|
101
|
+
@_hash['vouchers'] = 'vouchers'
|
|
102
|
+
@_hash['unit_price'] = 'unitPrice'
|
|
103
|
+
@_hash['unit_measure'] = 'unitMeasure'
|
|
104
|
+
@_hash['ev'] = 'EV'
|
|
105
|
+
@_hash['points'] = 'points'
|
|
106
|
+
@_hash
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# An array for optional fields
|
|
110
|
+
def self.optionals
|
|
111
|
+
%w[
|
|
112
|
+
description
|
|
113
|
+
offer_lang
|
|
114
|
+
original_net_amount
|
|
115
|
+
vat_amount
|
|
116
|
+
vat_rate
|
|
117
|
+
voucher_items
|
|
118
|
+
vouchers
|
|
119
|
+
unit_price
|
|
120
|
+
unit_measure
|
|
121
|
+
ev
|
|
122
|
+
points
|
|
123
|
+
]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# An array for nullable fields
|
|
127
|
+
def self.nullables
|
|
128
|
+
[]
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def initialize(amount:, detail_type:, discount_amount:, offer_infos:,
|
|
132
|
+
original_amount:, product_data:, quantity:,
|
|
133
|
+
description: SKIP, offer_lang: SKIP,
|
|
134
|
+
original_net_amount: SKIP, vat_amount: SKIP, vat_rate: SKIP,
|
|
135
|
+
voucher_items: SKIP, vouchers: SKIP, unit_price: SKIP,
|
|
136
|
+
unit_measure: SKIP, ev: SKIP, points: SKIP,
|
|
137
|
+
additional_properties: nil)
|
|
138
|
+
# Add additional model properties to the instance
|
|
139
|
+
additional_properties = {} if additional_properties.nil?
|
|
140
|
+
|
|
141
|
+
@description = description unless description == SKIP
|
|
142
|
+
@amount = amount
|
|
143
|
+
@detail_type = detail_type
|
|
144
|
+
@discount_amount = discount_amount
|
|
145
|
+
@offer_infos = offer_infos
|
|
146
|
+
@offer_lang = offer_lang unless offer_lang == SKIP
|
|
147
|
+
@original_amount = original_amount
|
|
148
|
+
@original_net_amount = original_net_amount unless original_net_amount == SKIP
|
|
149
|
+
@product_data = product_data
|
|
150
|
+
@quantity = quantity
|
|
151
|
+
@vat_amount = vat_amount unless vat_amount == SKIP
|
|
152
|
+
@vat_rate = vat_rate unless vat_rate == SKIP
|
|
153
|
+
@voucher_items = voucher_items unless voucher_items == SKIP
|
|
154
|
+
@vouchers = vouchers unless vouchers == SKIP
|
|
155
|
+
@unit_price = unit_price unless unit_price == SKIP
|
|
156
|
+
@unit_measure = unit_measure unless unit_measure == SKIP
|
|
157
|
+
@ev = ev unless ev == SKIP
|
|
158
|
+
@points = points unless points == SKIP
|
|
159
|
+
@additional_properties = additional_properties
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Creates an instance of the object from a hash.
|
|
163
|
+
def self.from_hash(hash)
|
|
164
|
+
return nil unless hash
|
|
165
|
+
|
|
166
|
+
# Extract variables from the hash.
|
|
167
|
+
amount = hash.key?('amount') ? hash['amount'] : nil
|
|
168
|
+
detail_type = hash.key?('detailType') ? hash['detailType'] : nil
|
|
169
|
+
discount_amount =
|
|
170
|
+
hash.key?('discountAmount') ? hash['discountAmount'] : nil
|
|
171
|
+
# Parameter is an array, so we need to iterate through it
|
|
172
|
+
offer_infos = nil
|
|
173
|
+
unless hash['offerInfos'].nil?
|
|
174
|
+
offer_infos = []
|
|
175
|
+
hash['offerInfos'].each do |structure|
|
|
176
|
+
offer_infos << (OfferInfo.from_hash(structure) if structure)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
offer_infos = nil unless hash.key?('offerInfos')
|
|
181
|
+
original_amount =
|
|
182
|
+
hash.key?('originalAmount') ? hash['originalAmount'] : nil
|
|
183
|
+
product_data = SaleItemProduct.from_hash(hash['productData']) if hash['productData']
|
|
184
|
+
quantity = hash.key?('quantity') ? hash['quantity'] : nil
|
|
185
|
+
description = hash.key?('description') ? hash['description'] : SKIP
|
|
186
|
+
offer_lang = OfferLanguage.from_hash(hash['offerLang']) if hash['offerLang']
|
|
187
|
+
original_net_amount =
|
|
188
|
+
hash.key?('originalNetAmount') ? hash['originalNetAmount'] : SKIP
|
|
189
|
+
vat_amount = hash.key?('vatAmount') ? hash['vatAmount'] : SKIP
|
|
190
|
+
vat_rate = hash.key?('vatRate') ? hash['vatRate'] : SKIP
|
|
191
|
+
# Parameter is an array, so we need to iterate through it
|
|
192
|
+
voucher_items = nil
|
|
193
|
+
unless hash['voucherItems'].nil?
|
|
194
|
+
voucher_items = []
|
|
195
|
+
hash['voucherItems'].each do |structure|
|
|
196
|
+
voucher_items << (VoucherItem.from_hash(structure) if structure)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
voucher_items = SKIP unless hash.key?('voucherItems')
|
|
201
|
+
vouchers = hash.key?('vouchers') ? hash['vouchers'] : SKIP
|
|
202
|
+
unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP
|
|
203
|
+
unit_measure = hash.key?('unitMeasure') ? hash['unitMeasure'] : SKIP
|
|
204
|
+
ev = EvChargingDetails.from_hash(hash['EV']) if hash['EV']
|
|
205
|
+
points = hash.key?('points') ? hash['points'] : SKIP
|
|
206
|
+
|
|
207
|
+
# Create a new hash for additional properties, removing known properties.
|
|
208
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
209
|
+
|
|
210
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
211
|
+
new_hash, proc { |value| value }
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
# Create object from extracted values.
|
|
215
|
+
SaleItem.new(amount: amount,
|
|
216
|
+
detail_type: detail_type,
|
|
217
|
+
discount_amount: discount_amount,
|
|
218
|
+
offer_infos: offer_infos,
|
|
219
|
+
original_amount: original_amount,
|
|
220
|
+
product_data: product_data,
|
|
221
|
+
quantity: quantity,
|
|
222
|
+
description: description,
|
|
223
|
+
offer_lang: offer_lang,
|
|
224
|
+
original_net_amount: original_net_amount,
|
|
225
|
+
vat_amount: vat_amount,
|
|
226
|
+
vat_rate: vat_rate,
|
|
227
|
+
voucher_items: voucher_items,
|
|
228
|
+
vouchers: vouchers,
|
|
229
|
+
unit_price: unit_price,
|
|
230
|
+
unit_measure: unit_measure,
|
|
231
|
+
ev: ev,
|
|
232
|
+
points: points,
|
|
233
|
+
additional_properties: additional_properties)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Provides a human-readable string representation of the object.
|
|
237
|
+
def to_s
|
|
238
|
+
class_name = self.class.name.split('::').last
|
|
239
|
+
"<#{class_name} description: #{@description}, amount: #{@amount}, detail_type:"\
|
|
240
|
+
" #{@detail_type}, discount_amount: #{@discount_amount}, offer_infos: #{@offer_infos},"\
|
|
241
|
+
" offer_lang: #{@offer_lang}, original_amount: #{@original_amount}, original_net_amount:"\
|
|
242
|
+
" #{@original_net_amount}, product_data: #{@product_data}, quantity: #{@quantity},"\
|
|
243
|
+
" vat_amount: #{@vat_amount}, vat_rate: #{@vat_rate}, voucher_items: #{@voucher_items},"\
|
|
244
|
+
" vouchers: #{@vouchers}, unit_price: #{@unit_price}, unit_measure: #{@unit_measure}, ev:"\
|
|
245
|
+
" #{@ev}, points: #{@points}, additional_properties: #{@additional_properties}>"
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
249
|
+
def inspect
|
|
250
|
+
class_name = self.class.name.split('::').last
|
|
251
|
+
"<#{class_name} description: #{@description.inspect}, amount: #{@amount.inspect},"\
|
|
252
|
+
" detail_type: #{@detail_type.inspect}, discount_amount: #{@discount_amount.inspect},"\
|
|
253
|
+
" offer_infos: #{@offer_infos.inspect}, offer_lang: #{@offer_lang.inspect}, original_amount:"\
|
|
254
|
+
" #{@original_amount.inspect}, original_net_amount: #{@original_net_amount.inspect},"\
|
|
255
|
+
" product_data: #{@product_data.inspect}, quantity: #{@quantity.inspect}, vat_amount:"\
|
|
256
|
+
" #{@vat_amount.inspect}, vat_rate: #{@vat_rate.inspect}, voucher_items:"\
|
|
257
|
+
" #{@voucher_items.inspect}, vouchers: #{@vouchers.inspect}, unit_price:"\
|
|
258
|
+
" #{@unit_price.inspect}, unit_measure: #{@unit_measure.inspect}, ev: #{@ev.inspect},"\
|
|
259
|
+
" points: #{@points.inspect}, additional_properties: #{@additional_properties}>"
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# SaleItemProduct Model.
|
|
8
|
+
class SaleItemProduct < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Unique Id of the product
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :id
|
|
15
|
+
|
|
16
|
+
# Name of the product
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# Indicating the Type of the product (Fuel, CR, CC, PARTNER, OTHER,
|
|
21
|
+
# GREEN_ENERGY).
|
|
22
|
+
# @return [ProductType]
|
|
23
|
+
attr_accessor :product_type
|
|
24
|
+
|
|
25
|
+
# Product code of gift item (euroShell Forward Code). To be populated with 3
|
|
26
|
+
# digit Euroshell product code.
|
|
27
|
+
# @return [String]
|
|
28
|
+
attr_accessor :product_code
|
|
29
|
+
|
|
30
|
+
# Product code of gift item (euroShell Forward Code). To be populated with 3
|
|
31
|
+
# digit Euroshell product code.
|
|
32
|
+
# @return [String]
|
|
33
|
+
attr_accessor :product_description
|
|
34
|
+
|
|
35
|
+
# Customer name of the product provided by the partner
|
|
36
|
+
# @return [String]
|
|
37
|
+
attr_accessor :additional_product_description
|
|
38
|
+
|
|
39
|
+
# A mapping from model property names to API property names.
|
|
40
|
+
def self.names
|
|
41
|
+
@_hash = {} if @_hash.nil?
|
|
42
|
+
@_hash['id'] = 'id'
|
|
43
|
+
@_hash['name'] = 'name'
|
|
44
|
+
@_hash['product_type'] = 'productType'
|
|
45
|
+
@_hash['product_code'] = 'productCode'
|
|
46
|
+
@_hash['product_description'] = 'productDescription'
|
|
47
|
+
@_hash['additional_product_description'] =
|
|
48
|
+
'additionalProductDescription'
|
|
49
|
+
@_hash
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# An array for optional fields
|
|
53
|
+
def self.optionals
|
|
54
|
+
%w[
|
|
55
|
+
product_code
|
|
56
|
+
product_description
|
|
57
|
+
additional_product_description
|
|
58
|
+
]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# An array for nullable fields
|
|
62
|
+
def self.nullables
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def initialize(id:, name:, product_type:, product_code: SKIP,
|
|
67
|
+
product_description: SKIP,
|
|
68
|
+
additional_product_description: SKIP,
|
|
69
|
+
additional_properties: nil)
|
|
70
|
+
# Add additional model properties to the instance
|
|
71
|
+
additional_properties = {} if additional_properties.nil?
|
|
72
|
+
|
|
73
|
+
@id = id
|
|
74
|
+
@name = name
|
|
75
|
+
@product_type = product_type
|
|
76
|
+
@product_code = product_code unless product_code == SKIP
|
|
77
|
+
@product_description = product_description unless product_description == SKIP
|
|
78
|
+
unless additional_product_description == SKIP
|
|
79
|
+
@additional_product_description =
|
|
80
|
+
additional_product_description
|
|
81
|
+
end
|
|
82
|
+
@additional_properties = additional_properties
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Creates an instance of the object from a hash.
|
|
86
|
+
def self.from_hash(hash)
|
|
87
|
+
return nil unless hash
|
|
88
|
+
|
|
89
|
+
# Extract variables from the hash.
|
|
90
|
+
id = hash.key?('id') ? hash['id'] : nil
|
|
91
|
+
name = hash.key?('name') ? hash['name'] : nil
|
|
92
|
+
product_type = hash.key?('productType') ? hash['productType'] : nil
|
|
93
|
+
product_code = hash.key?('productCode') ? hash['productCode'] : SKIP
|
|
94
|
+
product_description =
|
|
95
|
+
hash.key?('productDescription') ? hash['productDescription'] : SKIP
|
|
96
|
+
additional_product_description =
|
|
97
|
+
hash.key?('additionalProductDescription') ? hash['additionalProductDescription'] : SKIP
|
|
98
|
+
|
|
99
|
+
# Create a new hash for additional properties, removing known properties.
|
|
100
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
101
|
+
|
|
102
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
103
|
+
new_hash, proc { |value| value }
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Create object from extracted values.
|
|
107
|
+
SaleItemProduct.new(id: id,
|
|
108
|
+
name: name,
|
|
109
|
+
product_type: product_type,
|
|
110
|
+
product_code: product_code,
|
|
111
|
+
product_description: product_description,
|
|
112
|
+
additional_product_description: additional_product_description,
|
|
113
|
+
additional_properties: additional_properties)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Provides a human-readable string representation of the object.
|
|
117
|
+
def to_s
|
|
118
|
+
class_name = self.class.name.split('::').last
|
|
119
|
+
"<#{class_name} id: #{@id}, name: #{@name}, product_type: #{@product_type}, product_code:"\
|
|
120
|
+
" #{@product_code}, product_description: #{@product_description},"\
|
|
121
|
+
" additional_product_description: #{@additional_product_description}, additional_properties:"\
|
|
122
|
+
" #{@additional_properties}>"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
126
|
+
def inspect
|
|
127
|
+
class_name = self.class.name.split('::').last
|
|
128
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, product_type:"\
|
|
129
|
+
" #{@product_type.inspect}, product_code: #{@product_code.inspect}, product_description:"\
|
|
130
|
+
" #{@product_description.inspect}, additional_product_description:"\
|
|
131
|
+
" #{@additional_product_description.inspect}, additional_properties:"\
|
|
132
|
+
" #{@additional_properties}>"
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|