testerhjnew 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +55 -0
  4. data/lib/tester.rb +56 -0
  5. data/lib/tester/api_helper.rb +261 -0
  6. data/lib/tester/configuration.rb +66 -0
  7. data/lib/tester/controllers/base_controller.rb +59 -0
  8. data/lib/tester/controllers/body_params_controller.rb +1270 -0
  9. data/lib/tester/controllers/echo_controller.rb +134 -0
  10. data/lib/tester/controllers/error_codes_controller.rb +179 -0
  11. data/lib/tester/controllers/form_params_controller.rb +1391 -0
  12. data/lib/tester/controllers/header_controller.rb +63 -0
  13. data/lib/tester/controllers/query_param_controller.rb +779 -0
  14. data/lib/tester/controllers/response_types_controller.rb +717 -0
  15. data/lib/tester/controllers/template_params_controller.rb +93 -0
  16. data/lib/tester/exceptions/api_exception.rb +18 -0
  17. data/lib/tester/exceptions/global_test_exception.rb +32 -0
  18. data/lib/tester/exceptions/local_test_exception.rb +30 -0
  19. data/lib/tester/exceptions/nested_model_exception.rb +37 -0
  20. data/lib/tester/http/faraday_client.rb +55 -0
  21. data/lib/tester/http/http_call_back.rb +22 -0
  22. data/lib/tester/http/http_client.rb +92 -0
  23. data/lib/tester/http/http_context.rb +18 -0
  24. data/lib/tester/http/http_method_enum.rb +11 -0
  25. data/lib/tester/http/http_request.rb +48 -0
  26. data/lib/tester/http/http_response.rb +21 -0
  27. data/lib/tester/models/additional_model_parameters.rb +70 -0
  28. data/lib/tester/models/base_model.rb +52 -0
  29. data/lib/tester/models/boss.rb +129 -0
  30. data/lib/tester/models/days.rb +30 -0
  31. data/lib/tester/models/delete_body.rb +52 -0
  32. data/lib/tester/models/echo_response.rb +88 -0
  33. data/lib/tester/models/employee.rb +155 -0
  34. data/lib/tester/models/job.rb +43 -0
  35. data/lib/tester/models/person.rb +113 -0
  36. data/lib/tester/models/query_parameter.rb +43 -0
  37. data/lib/tester/models/server_response.rb +61 -0
  38. data/lib/tester/models/suite_code.rb +21 -0
  39. data/lib/tester/models/test_nstring_encoding.rb +52 -0
  40. data/lib/tester/models/test_r_nstring_encoding.rb +52 -0
  41. data/lib/tester/models/test_rstring_encoding.rb +52 -0
  42. data/lib/tester/models/validate.rb +61 -0
  43. data/lib/tester/tester_client.rb +61 -0
  44. data/test/controllers/controller_test_base.rb +33 -0
  45. data/test/controllers/test_body_params_controller.rb +1210 -0
  46. data/test/controllers/test_echo_controller.rb +29 -0
  47. data/test/controllers/test_error_codes_controller.rb +47 -0
  48. data/test/controllers/test_form_params_controller.rb +1099 -0
  49. data/test/controllers/test_header_controller.rb +30 -0
  50. data/test/controllers/test_query_param_controller.rb +345 -0
  51. data/test/controllers/test_response_types_controller.rb +429 -0
  52. data/test/controllers/test_template_params_controller.rb +47 -0
  53. data/test/http_response_catcher.rb +16 -0
  54. data/test/test_helper.rb +91 -0
  55. metadata +178 -0
@@ -0,0 +1,155 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ require_relative 'person'
6
+
7
+ module Tester
8
+ # Employee Model.
9
+ class Employee < Person
10
+ # TODO: Write general description for this method
11
+ # @return [String]
12
+ attr_accessor :department
13
+
14
+ # TODO: Write general description for this method
15
+ # @return [List of Person]
16
+ attr_accessor :dependents
17
+
18
+ # TODO: Write general description for this method
19
+ # @return [DateTime]
20
+ attr_accessor :hired_at
21
+
22
+ # TODO: Write general description for this method
23
+ # @return [Days]
24
+ attr_accessor :joining_day
25
+
26
+ # TODO: Write general description for this method
27
+ # @return [Integer]
28
+ attr_accessor :salary
29
+
30
+ # TODO: Write general description for this method
31
+ # @return [List of Days]
32
+ attr_accessor :working_days
33
+
34
+ # TODO: Write general description for this method
35
+ # @return [Person]
36
+ attr_accessor :boss
37
+
38
+ # Discriminators mapping.
39
+ def self.discriminators
40
+ if @_discriminators.nil?
41
+ @_discriminators = {}
42
+ @_discriminators['Boss'] = Boss.method(:from_hash)
43
+ end
44
+ @_discriminators
45
+ end
46
+
47
+ # A mapping from model property names to API property names.
48
+ def self.names
49
+ @_hash = {} if @_hash.nil?
50
+ @_hash['department'] = 'department'
51
+ @_hash['dependents'] = 'dependents'
52
+ @_hash['hired_at'] = 'hiredAt'
53
+ @_hash['joining_day'] = 'joiningDay'
54
+ @_hash['salary'] = 'salary'
55
+ @_hash['working_days'] = 'workingDays'
56
+ @_hash['boss'] = 'boss'
57
+ @_hash = super().merge(@_hash)
58
+ @_hash
59
+ end
60
+
61
+ def initialize(address = nil,
62
+ age = nil,
63
+ birthday = nil,
64
+ birthtime = nil,
65
+ department = nil,
66
+ dependents = nil,
67
+ hired_at = nil,
68
+ joining_day = Days::MONDAY,
69
+ name = nil,
70
+ salary = nil,
71
+ uid = nil,
72
+ working_days = nil,
73
+ boss = nil,
74
+ person_type = nil,
75
+ additional_properties = {})
76
+ @department = department
77
+ @dependents = dependents
78
+ @hired_at = hired_at
79
+ @joining_day = joining_day
80
+ @salary = salary
81
+ @working_days = working_days
82
+ @boss = boss
83
+ def hired_at.to_s
84
+ httpdate
85
+ end
86
+
87
+ # Add additional model properties to the instance.
88
+ additional_properties.each do |_name, value|
89
+ instance_variable_set("@#{_name}", value)
90
+ end
91
+
92
+ # Call the constructor of the base class
93
+ super(address,
94
+ age,
95
+ birthday,
96
+ birthtime,
97
+ name,
98
+ uid,
99
+ person_type)
100
+ end
101
+
102
+ # Creates an instance of the object from a hash.
103
+ def self.from_hash(hash)
104
+ return nil unless hash
105
+
106
+ # Delegate unboxing to another function if a discriminator
107
+ # value for a child class is present.
108
+ unboxer = discriminators[hash['personType']]
109
+ return unboxer.call(hash) if unboxer
110
+
111
+ # Extract variables from the hash.
112
+ address = hash['address']
113
+ age = hash['age']
114
+ birthday = hash['birthday']
115
+ birthtime = DateTime.rfc3339(hash['birthtime']) if hash['birthtime']
116
+ department = hash['department']
117
+ # Parameter is an array, so we need to iterate through it
118
+ dependents = nil
119
+ unless hash['dependents'].nil?
120
+ dependents = []
121
+ hash['dependents'].each do |structure|
122
+ dependents << (Person.from_hash(structure) if structure)
123
+ end
124
+ end
125
+ hired_at = DateTime.httpdate(hash['hiredAt']) if hash['hiredAt']
126
+ joining_day = hash['joiningDay'] ||= Days::MONDAY
127
+ name = hash['name']
128
+ salary = hash['salary']
129
+ uid = hash['uid']
130
+ working_days = hash['workingDays']
131
+ boss = Person.from_hash(hash['boss']) if hash['boss']
132
+ person_type = hash['personType']
133
+
134
+ # Clean out expected properties from Hash.
135
+ names.each_value { |k| hash.delete(k) }
136
+
137
+ # Create object from extracted values.
138
+ Employee.new(address,
139
+ age,
140
+ birthday,
141
+ birthtime,
142
+ department,
143
+ dependents,
144
+ hired_at,
145
+ joining_day,
146
+ name,
147
+ salary,
148
+ uid,
149
+ working_days,
150
+ boss,
151
+ person_type,
152
+ hash)
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,43 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module Tester
5
+ # Job Model.
6
+ class Job < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :company
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ @_hash = {} if @_hash.nil?
14
+ @_hash['company'] = 'company'
15
+ @_hash
16
+ end
17
+
18
+ def initialize(company = nil,
19
+ additional_properties = {})
20
+ @company = company
21
+
22
+ # Add additional model properties to the instance.
23
+ additional_properties.each do |_name, value|
24
+ instance_variable_set("@#{_name}", value)
25
+ end
26
+ end
27
+
28
+ # Creates an instance of the object from a hash.
29
+ def self.from_hash(hash)
30
+ return nil unless hash
31
+
32
+ # Extract variables from the hash.
33
+ company = hash['company']
34
+
35
+ # Clean out expected properties from Hash.
36
+ names.each_value { |k| hash.delete(k) }
37
+
38
+ # Create object from extracted values.
39
+ Job.new(company,
40
+ hash)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,113 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module Tester
6
+ # Person Model.
7
+ class Person < BaseModel
8
+ # TODO: Write general description for this method
9
+ # @return [String]
10
+ attr_accessor :address
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Long]
14
+ attr_accessor :age
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Date]
18
+ attr_accessor :birthday
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [DateTime]
22
+ attr_accessor :birthtime
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :name
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :uid
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :person_type
35
+
36
+ # Discriminators mapping.
37
+ def self.discriminators
38
+ if @_discriminators.nil?
39
+ @_discriminators = {}
40
+ @_discriminators['Empl'] = Employee.method(:from_hash)
41
+ @_discriminators['Boss'] = Boss.method(:from_hash)
42
+ end
43
+ @_discriminators
44
+ end
45
+
46
+ # A mapping from model property names to API property names.
47
+ def self.names
48
+ @_hash = {} if @_hash.nil?
49
+ @_hash['address'] = 'address'
50
+ @_hash['age'] = 'age'
51
+ @_hash['birthday'] = 'birthday'
52
+ @_hash['birthtime'] = 'birthtime'
53
+ @_hash['name'] = 'name'
54
+ @_hash['uid'] = 'uid'
55
+ @_hash['person_type'] = 'personType'
56
+ @_hash
57
+ end
58
+
59
+ def initialize(address = nil,
60
+ age = nil,
61
+ birthday = nil,
62
+ birthtime = nil,
63
+ name = nil,
64
+ uid = nil,
65
+ person_type = nil,
66
+ additional_properties = {})
67
+ @address = address
68
+ @age = age
69
+ @birthday = birthday
70
+ @birthtime = birthtime
71
+ @name = name
72
+ @uid = uid
73
+ @person_type = person_type
74
+
75
+ # Add additional model properties to the instance.
76
+ additional_properties.each do |_name, value|
77
+ instance_variable_set("@#{_name}", value)
78
+ end
79
+ end
80
+
81
+ # Creates an instance of the object from a hash.
82
+ def self.from_hash(hash)
83
+ return nil unless hash
84
+
85
+ # Delegate unboxing to another function if a discriminator
86
+ # value for a child class is present.
87
+ unboxer = discriminators[hash['personType']]
88
+ return unboxer.call(hash) if unboxer
89
+
90
+ # Extract variables from the hash.
91
+ address = hash['address']
92
+ age = hash['age']
93
+ birthday = hash['birthday']
94
+ birthtime = DateTime.rfc3339(hash['birthtime']) if hash['birthtime']
95
+ name = hash['name']
96
+ uid = hash['uid']
97
+ person_type = hash['personType']
98
+
99
+ # Clean out expected properties from Hash.
100
+ names.each_value { |k| hash.delete(k) }
101
+
102
+ # Create object from extracted values.
103
+ Person.new(address,
104
+ age,
105
+ birthday,
106
+ birthtime,
107
+ name,
108
+ uid,
109
+ person_type,
110
+ hash)
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,43 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module Tester
5
+ # Query parameter key value pair echoed back from the server.
6
+ class QueryParameter < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :key
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ @_hash = {} if @_hash.nil?
14
+ @_hash['key'] = 'key'
15
+ @_hash
16
+ end
17
+
18
+ def initialize(key = nil,
19
+ additional_properties = {})
20
+ @key = key
21
+
22
+ # Add additional model properties to the instance.
23
+ additional_properties.each do |_name, value|
24
+ instance_variable_set("@#{_name}", value)
25
+ end
26
+ end
27
+
28
+ # Creates an instance of the object from a hash.
29
+ def self.from_hash(hash)
30
+ return nil unless hash
31
+
32
+ # Extract variables from the hash.
33
+ key = hash['key']
34
+
35
+ # Clean out expected properties from Hash.
36
+ names.each_value { |k| hash.delete(k) }
37
+
38
+ # Create object from extracted values.
39
+ QueryParameter.new(key,
40
+ hash)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,61 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module Tester
5
+ # ServerResponse Model.
6
+ class ServerResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [Boolean]
9
+ attr_accessor :passed
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :message
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [Array<String, Object>]
17
+ attr_accessor :input
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['passed'] = 'passed'
23
+ @_hash['message'] = 'Message'
24
+ @_hash['input'] = 'input'
25
+ @_hash
26
+ end
27
+
28
+ def initialize(passed = nil,
29
+ message = nil,
30
+ input = nil,
31
+ additional_properties = {})
32
+ @passed = passed
33
+ @message = message
34
+ @input = input
35
+
36
+ # Add additional model properties to the instance.
37
+ additional_properties.each do |_name, value|
38
+ instance_variable_set("@#{_name}", value)
39
+ end
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
+ passed = hash['passed']
48
+ message = hash['Message']
49
+ input = hash['input']
50
+
51
+ # Clean out expected properties from Hash.
52
+ names.each_value { |k| hash.delete(k) }
53
+
54
+ # Create object from extracted values.
55
+ ServerResponse.new(passed,
56
+ message,
57
+ input,
58
+ hash)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,21 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module Tester
5
+ # A integer based enum representing a Suite in a game of cards
6
+ class SuiteCode
7
+ SUITE_CODE = [
8
+ # TODO: Write general description for HEARTS
9
+ HEARTS = 1,
10
+
11
+ # TODO: Write general description for SPADES
12
+ SPADES = 2,
13
+
14
+ # TODO: Write general description for CLUBS
15
+ CLUBS = 3,
16
+
17
+ # TODO: Write general description for DIAMONDS
18
+ DIAMONDS = 4
19
+ ].freeze
20
+ end
21
+ end
@@ -0,0 +1,52 @@
1
+ # This file was automatically generated for Stamplay by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module Tester
5
+ # TestNstringEncoding Model.
6
+ class TestNstringEncoding < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :field
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :name
14
+
15
+ # A mapping from model property names to API property names.
16
+ def self.names
17
+ @_hash = {} if @_hash.nil?
18
+ @_hash['field'] = 'field'
19
+ @_hash['name'] = 'name'
20
+ @_hash
21
+ end
22
+
23
+ def initialize(field = nil,
24
+ name = nil,
25
+ additional_properties = {})
26
+ @field = field
27
+ @name = name
28
+
29
+ # Add additional model properties to the instance.
30
+ additional_properties.each do |_name, value|
31
+ instance_variable_set("@#{_name}", value)
32
+ end
33
+ end
34
+
35
+ # Creates an instance of the object from a hash.
36
+ def self.from_hash(hash)
37
+ return nil unless hash
38
+
39
+ # Extract variables from the hash.
40
+ field = hash['field']
41
+ name = hash['name']
42
+
43
+ # Clean out expected properties from Hash.
44
+ names.each_value { |k| hash.delete(k) }
45
+
46
+ # Create object from extracted values.
47
+ TestNstringEncoding.new(field,
48
+ name,
49
+ hash)
50
+ end
51
+ end
52
+ end