mastercard_spendalerts 1.0.0 → 1.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.
@@ -27,109 +27,117 @@
27
27
 
28
28
 
29
29
  require "mastercard/core/model"
30
+ require "mastercard/core/baseobject"
30
31
 
31
32
  module MasterCard
32
- module API
33
- module Spendalerts
34
- class Crossborder < MasterCard::Core::Model::BaseObject
35
- include MasterCard::Core::Model
36
- #
33
+ module API
34
+ module Spendalerts
35
+ class Crossborder < MasterCard::Core::Model::BaseObject
36
+ include MasterCard::Core::Model
37
+ #
37
38
 
38
- @__store = {
39
- '5d0b7ee2-6574-462d-8803-b1b38304efc9' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "query", [], []),
40
- 'd3c8461b-c495-4e83-a879-2bbba6fe9985' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "create", [], []),
41
- '8298e85a-978a-48b8-8c35-45519a576743' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "delete", [], []),
42
-
43
- }
39
+ @__store = {
40
+ 'cf438386-2de4-46d4-a6a1-78bf6a12bfe0' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "delete", [], []),
41
+ '541a8a8a-a1c7-4d41-afb8-9c00842cab75' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "query", [], []),
42
+ 'ee5fcb58-607e-4d5b-ad2d-0ffc7f968fb0' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/alerts/crossborder", "create", [], []),
43
+
44
+ }
44
45
 
45
- protected
46
+ protected
46
47
 
47
- def self.getOperationConfig(uuid)
48
- if @__store.key?(uuid)
49
- return @__store[uuid]
50
- end
51
- raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
52
- end
48
+ def self.getOperationConfig(uuid)
49
+ if @__store.key?(uuid)
50
+ return @__store[uuid]
51
+ end
52
+ raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
53
+ end
53
54
 
54
- def self.getOperationMetadata()
55
- return OperationMetadata.new(SDKConfig.getVersion(), SDKConfig.getHost())
56
- end
55
+ def self.getOperationMetadata()
56
+ return OperationMetadata.new(ResourceConfig.instance.getVersion(), ResourceConfig.instance.getHost(), ResourceConfig.instance.getContext())
57
+ end
57
58
 
58
- public
59
+ public
59
60
 
60
61
 
61
62
 
62
63
 
63
64
 
65
+ def self.deleteById(id, map = nil)
66
+ #Delete object of type Crossborder by id
64
67
 
65
- def self.query(criteria)
66
- #
67
- #Query objects of type Crossborder by id and optional criteria
68
- #@param type criteria
69
- #@return Crossborder object representing the response.
70
- #
68
+ #@param [String] id
69
+ #@param [Dict] map, containing additional parameters
70
+ #@return [Crossborder] of the response of the deleted instance.
71
+ #@raise [APIException] an exception from the response status
71
72
 
72
- return self.execute("5d0b7ee2-6574-462d-8803-b1b38304efc9",Crossborder.new(criteria))
73
- end
74
73
 
75
- def self.create(mapObj)
76
- #
77
- #Creates object of type Crossborder
78
- #
79
- #@param Dict mapObj, containing the required parameters to create a new object
80
- #@return Crossborder of the response of created instance.
81
- #
82
- return self.execute("d3c8461b-c495-4e83-a879-2bbba6fe9985", Crossborder.new(mapObj))
83
- end
74
+ mapObj = Crossborder.new
75
+ if !(id.nil? || id.to_s.empty?)
76
+ mapObj.set("id", id)
77
+ end
78
+ if !map.nil?
79
+ if map.instance_of? RequestMap
80
+ mapObj.setAll(map.getObject())
81
+ else
82
+ mapObj.setAll(map)
83
+ end
84
+ end
84
85
 
86
+ return self.execute("cf438386-2de4-46d4-a6a1-78bf6a12bfe0", mapObj)
87
+ end
85
88
 
86
89
 
90
+ def delete
91
+ #
92
+ #Delete object of type Crossborder
87
93
 
94
+ #@param [String] id
95
+ #@return [Crossborder] of the response of the deleted instance.
96
+ #@raise [APIException] an exception from the response status
97
+ #
88
98
 
99
+ return self.class.execute("cf438386-2de4-46d4-a6a1-78bf6a12bfe0", self)
100
+ end
89
101
 
90
102
 
91
103
 
92
104
 
93
- def self.deleteById(id, map = nil)
94
- #Delete object of type Crossborder by id
95
105
 
96
- #@param str id
97
- #@param Dict map, containing additional parameters
98
- #@return Crossborder of the response of the deleted instance.
99
106
 
100
107
 
101
- mapObj = Crossborder.new
102
- if !(id.nil? || id.to_s.empty?)
103
- mapObj.set("id", id)
104
- end
105
- if !map.nil?
106
- if map.instance_of? RequestMap
107
- mapObj.setAll(map.getObject())
108
- else
109
- mapObj.setAll(map)
110
- end
111
- end
112
108
 
113
- return self.execute("8298e85a-978a-48b8-8c35-45519a576743", mapObj)
114
- end
115
109
 
110
+ def self.query(criteria)
111
+ #
112
+ #Query objects of type Crossborder by id and optional criteria
113
+ #@param [Dict] criteria
114
+ #@return [Crossborder] object representing the response.
115
+ #@raise [APIException] an exception from the response status
116
+ #
116
117
 
117
- def delete
118
- #
119
- #Delete object of type Crossborder
118
+ return self.execute("541a8a8a-a1c7-4d41-afb8-9c00842cab75",Crossborder.new(criteria))
119
+ end
120
120
 
121
- #@param str id
122
- #@return Crossborder of the response of the deleted instance.
123
- #
124
121
 
125
- return self.class.execute("8298e85a-978a-48b8-8c35-45519a576743", self)
126
- end
122
+ def self.create(mapObj)
123
+ #
124
+ #Creates object of type Crossborder
125
+ #
126
+ #@param Dict mapObj, containing the required parameters to create a new object
127
+ #@return [Crossborder] of the response of created instance.
128
+ #@raise [APIException] an exception from the response status
129
+ return self.execute("ee5fcb58-607e-4d5b-ad2d-0ffc7f968fb0", Crossborder.new(mapObj))
130
+ end
127
131
 
128
132
 
129
133
 
130
- end
131
- end
132
- end
134
+
135
+
136
+
137
+
138
+ end
139
+ end
140
+ end
133
141
  end
134
142
 
135
143
 
@@ -27,109 +27,117 @@
27
27
 
28
28
 
29
29
  require "mastercard/core/model"
30
+ require "mastercard/core/baseobject"
30
31
 
31
32
  module MasterCard
32
- module API
33
- module Spendalerts
34
- class Declines < MasterCard::Core::Model::BaseObject
35
- include MasterCard::Core::Model
36
- #
33
+ module API
34
+ module Spendalerts
35
+ class Declines < MasterCard::Core::Model::BaseObject
36
+ include MasterCard::Core::Model
37
+ #
37
38
 
38
- @__store = {
39
- '6e4bc79c-c888-44da-9dce-05e7853336f2' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "query", [], []),
40
- '885e8563-f626-4535-9428-64343189401b' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "create", [], []),
41
- 'fc28b750-eedf-4b49-9815-4c60dc703531' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "delete", [], []),
42
-
43
- }
39
+ @__store = {
40
+ '7b4086ce-58a6-4b21-b87d-5c8e04bc52cd' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "delete", [], []),
41
+ '0f6586cf-36d4-4174-b5b9-436b1801e9e1' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "query", [], []),
42
+ 'a7ab0b38-94b2-49b9-853f-3fbaccc79cd8' => OperationConfig.new("/issuer/v1/card/{uuid}/controls/declines", "create", [], []),
43
+
44
+ }
44
45
 
45
- protected
46
+ protected
46
47
 
47
- def self.getOperationConfig(uuid)
48
- if @__store.key?(uuid)
49
- return @__store[uuid]
50
- end
51
- raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
52
- end
48
+ def self.getOperationConfig(uuid)
49
+ if @__store.key?(uuid)
50
+ return @__store[uuid]
51
+ end
52
+ raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
53
+ end
53
54
 
54
- def self.getOperationMetadata()
55
- return OperationMetadata.new(SDKConfig.getVersion(), SDKConfig.getHost())
56
- end
55
+ def self.getOperationMetadata()
56
+ return OperationMetadata.new(ResourceConfig.instance.getVersion(), ResourceConfig.instance.getHost(), ResourceConfig.instance.getContext())
57
+ end
57
58
 
58
- public
59
+ public
59
60
 
60
61
 
61
62
 
62
63
 
63
64
 
65
+ def self.deleteById(id, map = nil)
66
+ #Delete object of type Declines by id
64
67
 
65
- def self.query(criteria)
66
- #
67
- #Query objects of type Declines by id and optional criteria
68
- #@param type criteria
69
- #@return Declines object representing the response.
70
- #
68
+ #@param [String] id
69
+ #@param [Dict] map, containing additional parameters
70
+ #@return [Declines] of the response of the deleted instance.
71
+ #@raise [APIException] an exception from the response status
71
72
 
72
- return self.execute("6e4bc79c-c888-44da-9dce-05e7853336f2",Declines.new(criteria))
73
- end
74
73
 
75
- def self.create(mapObj)
76
- #
77
- #Creates object of type Declines
78
- #
79
- #@param Dict mapObj, containing the required parameters to create a new object
80
- #@return Declines of the response of created instance.
81
- #
82
- return self.execute("885e8563-f626-4535-9428-64343189401b", Declines.new(mapObj))
83
- end
74
+ mapObj = Declines.new
75
+ if !(id.nil? || id.to_s.empty?)
76
+ mapObj.set("id", id)
77
+ end
78
+ if !map.nil?
79
+ if map.instance_of? RequestMap
80
+ mapObj.setAll(map.getObject())
81
+ else
82
+ mapObj.setAll(map)
83
+ end
84
+ end
84
85
 
86
+ return self.execute("7b4086ce-58a6-4b21-b87d-5c8e04bc52cd", mapObj)
87
+ end
85
88
 
86
89
 
90
+ def delete
91
+ #
92
+ #Delete object of type Declines
87
93
 
94
+ #@param [String] id
95
+ #@return [Declines] of the response of the deleted instance.
96
+ #@raise [APIException] an exception from the response status
97
+ #
88
98
 
99
+ return self.class.execute("7b4086ce-58a6-4b21-b87d-5c8e04bc52cd", self)
100
+ end
89
101
 
90
102
 
91
103
 
92
104
 
93
- def self.deleteById(id, map = nil)
94
- #Delete object of type Declines by id
95
105
 
96
- #@param str id
97
- #@param Dict map, containing additional parameters
98
- #@return Declines of the response of the deleted instance.
99
106
 
100
107
 
101
- mapObj = Declines.new
102
- if !(id.nil? || id.to_s.empty?)
103
- mapObj.set("id", id)
104
- end
105
- if !map.nil?
106
- if map.instance_of? RequestMap
107
- mapObj.setAll(map.getObject())
108
- else
109
- mapObj.setAll(map)
110
- end
111
- end
112
108
 
113
- return self.execute("fc28b750-eedf-4b49-9815-4c60dc703531", mapObj)
114
- end
115
109
 
110
+ def self.query(criteria)
111
+ #
112
+ #Query objects of type Declines by id and optional criteria
113
+ #@param [Dict] criteria
114
+ #@return [Declines] object representing the response.
115
+ #@raise [APIException] an exception from the response status
116
+ #
116
117
 
117
- def delete
118
- #
119
- #Delete object of type Declines
118
+ return self.execute("0f6586cf-36d4-4174-b5b9-436b1801e9e1",Declines.new(criteria))
119
+ end
120
120
 
121
- #@param str id
122
- #@return Declines of the response of the deleted instance.
123
- #
124
121
 
125
- return self.class.execute("fc28b750-eedf-4b49-9815-4c60dc703531", self)
126
- end
122
+ def self.create(mapObj)
123
+ #
124
+ #Creates object of type Declines
125
+ #
126
+ #@param Dict mapObj, containing the required parameters to create a new object
127
+ #@return [Declines] of the response of created instance.
128
+ #@raise [APIException] an exception from the response status
129
+ return self.execute("a7ab0b38-94b2-49b9-853f-3fbaccc79cd8", Declines.new(mapObj))
130
+ end
127
131
 
128
132
 
129
133
 
130
- end
131
- end
132
- end
134
+
135
+
136
+
137
+
138
+ end
139
+ end
140
+ end
133
141
  end
134
142
 
135
143
 
@@ -24,27 +24,75 @@
24
24
  # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
25
  # SUCH DAMAGE.
26
26
  #
27
+
28
+ require "mastercard/core/constants"
29
+ require "mastercard/core/config"
30
+
27
31
  module MasterCard
28
- module API
29
- module Spendalerts
30
- class SDKConfig
31
-
32
- private
33
- @@host = nil
34
-
35
- public
36
- def self.setHost(host)
37
- @@host = host
38
- end
39
-
40
- def self.getHost()
41
- return @@host
42
- end
43
-
44
- def self.getVersion()
45
- return "1.0.0"
46
- end
47
- end
48
- end
49
- end
32
+ module API
33
+ module Spendalerts
34
+ class ResourceConfig
35
+ include MasterCard::Core
36
+
37
+ @@instance = nil
38
+
39
+ def initialize
40
+ @name = "spendalerts"
41
+ @override = nil
42
+ @host = nil
43
+ @context = nil
44
+ @version = "1.0.1"
45
+
46
+ Config.registerResourceConfig(self)
47
+ currentEnvironment = Config.getEnvironment()
48
+ self.setEnvironment(currentEnvironment)
49
+
50
+ end
51
+
52
+
53
+ def self.instance
54
+ return @@instance
55
+ end
56
+
57
+
58
+ def getName
59
+ return @name
60
+ end
61
+
62
+
63
+ def getHost
64
+ unless @override.nil? || @override == 0
65
+ return @override
66
+ else
67
+ return @host
68
+ end
69
+ end
70
+
71
+ def getContext
72
+ return @context
73
+ end
74
+
75
+ def getVersion
76
+ return @version
77
+ end
78
+
79
+ def setEnvironment(environmet)
80
+ if Environment::MAPPING.key?(environmet)
81
+ tuple = Environment::MAPPING[environmet]
82
+ @host = tuple[0]
83
+ @context = tuple[1]
84
+ end
85
+ end
86
+
87
+ def setCustomEnvironment(host,context)
88
+ @host = host
89
+ @context = context
90
+ end
91
+
92
+ @@instance = ResourceConfig.new
93
+
94
+ private_class_method :new
95
+ end
96
+ end
97
+ end
50
98
  end