zombie_battleground-api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +62 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +21 -0
  5. data/.travis.yml +5 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Dockerfile +33 -0
  8. data/Gemfile +8 -0
  9. data/Gemfile.lock +85 -0
  10. data/LICENSE +21 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +57 -0
  13. data/Rakefile +16 -0
  14. data/bin/console +12 -0
  15. data/bin/setup +8 -0
  16. data/docker-compose.yml +4 -0
  17. data/lib/zombie_battleground/api/client.rb +114 -0
  18. data/lib/zombie_battleground/api/errors.rb +24 -0
  19. data/lib/zombie_battleground/api/models/card.rb +46 -0
  20. data/lib/zombie_battleground/api/models/deck.rb +65 -0
  21. data/lib/zombie_battleground/api/models/match.rb +47 -0
  22. data/lib/zombie_battleground/api/models/simple_card.rb +27 -0
  23. data/lib/zombie_battleground/api/requests/get_card_request.rb +27 -0
  24. data/lib/zombie_battleground/api/requests/get_cards_request.rb +40 -0
  25. data/lib/zombie_battleground/api/requests/get_deck_request.rb +30 -0
  26. data/lib/zombie_battleground/api/requests/get_decks_request.rb +36 -0
  27. data/lib/zombie_battleground/api/requests/get_match_request.rb +30 -0
  28. data/lib/zombie_battleground/api/requests/get_matches_request.rb +34 -0
  29. data/lib/zombie_battleground/api/requests/request_helper.rb +20 -0
  30. data/lib/zombie_battleground/api/responses/get_card_response.rb +38 -0
  31. data/lib/zombie_battleground/api/responses/get_cards_response.rb +54 -0
  32. data/lib/zombie_battleground/api/responses/get_deck_response.rb +38 -0
  33. data/lib/zombie_battleground/api/responses/get_decks_response.rb +54 -0
  34. data/lib/zombie_battleground/api/responses/get_match_response.rb +38 -0
  35. data/lib/zombie_battleground/api/responses/get_matches_response.rb +54 -0
  36. data/lib/zombie_battleground/api/responses/response_helper.rb +28 -0
  37. data/lib/zombie_battleground/api/validation_helper.rb +347 -0
  38. data/lib/zombie_battleground/api/version.rb +7 -0
  39. data/lib/zombie_battleground/api.rb +40 -0
  40. data/zombie_battleground-api.gemspec +40 -0
  41. metadata +196 -0
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+
5
+ require 'zombie_battleground/api/validation_helper'
6
+ require 'zombie_battleground/api/requests/request_helper'
7
+
8
+ module ZombieBattleground
9
+ class Api
10
+ ##
11
+ # Request validator for GetDecks
12
+ class GetDecksRequest
13
+ include ActiveModel::Validations
14
+ include ZombieBattleground::Api::ValidationHelper
15
+ include ZombieBattleground::Api::RequestHelper
16
+
17
+ attr_accessor :id, :user_id, :deck_id, :name, :hero_id, :primary_skill_id,
18
+ :secondary_skill_id, :version, :page, :limit
19
+
20
+ validate :id_is_a_non_negative_integer
21
+ validate :user_id_is_a_string
22
+ validate :deck_id_is_a_non_negative_integer
23
+ validate :name_is_a_string
24
+ validate :hero_id_is_a_non_negative_integer
25
+ validate :primary_skill_id_is_a_non_negative_integer
26
+ validate :secondary_skill_id_is_a_non_negative_integer
27
+ validate :version_is_a_string
28
+ validate :page_is_a_non_negative_integer
29
+ validate :limit_is_a_non_negative_integer
30
+
31
+ def uri
32
+ 'decks'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+
5
+ require 'zombie_battleground/api/validation_helper'
6
+ require 'zombie_battleground/api/requests/request_helper'
7
+
8
+ module ZombieBattleground
9
+ class Api
10
+ ##
11
+ # Request validator for GetMatch
12
+ class GetMatchRequest
13
+ include ActiveModel::Validations
14
+ include ZombieBattleground::Api::ValidationHelper
15
+ include ZombieBattleground::Api::RequestHelper
16
+
17
+ attr_accessor :id
18
+
19
+ validate :id_is_a_non_negative_integer
20
+
21
+ def uri
22
+ "match/#{id}"
23
+ end
24
+
25
+ def params
26
+ {}
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+
5
+ require 'zombie_battleground/api/validation_helper'
6
+ require 'zombie_battleground/api/requests/request_helper'
7
+
8
+ module ZombieBattleground
9
+ class Api
10
+ ##
11
+ # Request validator for GetMatches
12
+ class GetMatchesRequest
13
+ include ActiveModel::Validations
14
+ include ZombieBattleground::Api::ValidationHelper
15
+ include ZombieBattleground::Api::RequestHelper
16
+
17
+ attr_accessor :id, :player1_id, :player2_id, :status, :version, :winner_id,
18
+ :total, :page, :limit
19
+
20
+ validate :id_is_a_non_negative_integer
21
+ validate :player1_id_is_a_string
22
+ validate :player2_id_is_a_string
23
+ validate :status_is_a_string
24
+ validate :version_is_a_string
25
+ validate :winner_id_is_a_string
26
+ validate :page_is_a_non_negative_integer
27
+ validate :limit_is_a_non_negative_integer
28
+
29
+ def uri
30
+ 'matches'
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZombieBattleground
4
+ class Api
5
+ ##
6
+ # Provides generic methods for request validator classes
7
+ module RequestHelper
8
+ BLACKLISTED_INSTANCE_VARIABLES = %w[errors validation_context].freeze
9
+
10
+ def params
11
+ instance_variables.map do |var|
12
+ normalized_var = var.to_s.gsub(/^@/, '')
13
+ next if BLACKLISTED_INSTANCE_VARIABLES.include?(normalized_var)
14
+
15
+ [normalized_var, instance_variable_get(var)]
16
+ end.compact.to_h
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/card'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetCard
14
+ class GetCardResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :card
20
+
21
+ validate :card_is_a_card
22
+
23
+ def initialize(response)
24
+ handle_errors(response)
25
+
26
+ @card = ZombieBattleground::Api::Card.new(JSON.parse(response.body))
27
+ end
28
+
29
+ def card_is_a_card
30
+ return if @card.is_a?(ZombieBattleground::Api::Card) &&
31
+ @card.valid? &&
32
+ @card.errors.size.zero?
33
+
34
+ errors.add(:card, 'card must be a Card')
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/card'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetCards
14
+ class GetCardsResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :total, :page, :limit, :cards
20
+
21
+ validate :total_is_a_non_negative_integer
22
+ validate :page_is_a_non_negative_integer
23
+ validate :limit_is_a_non_negative_integer
24
+ validate :cards_is_an_array_of_card
25
+
26
+ def initialize(response)
27
+ handle_errors(response)
28
+
29
+ JSON.parse(response.body).each do |key, value|
30
+ if key == 'cards'
31
+ instance_variable_set("@#{key}".to_sym, value.map { |card| ZombieBattleground::Api::Card.new(card) })
32
+ else
33
+ instance_variable_set("@#{key}".to_sym, value)
34
+ end
35
+ end
36
+ end
37
+
38
+ def cards_is_an_array_of_card
39
+ unless @cards.is_a?(Array)
40
+ errors.add(:cards, 'Cards must be an array')
41
+ return
42
+ end
43
+
44
+ @cards.each do |card|
45
+ next if card.is_a?(ZombieBattleground::Api::Card) &&
46
+ card.valid? &&
47
+ card.errors.size.zero?
48
+
49
+ errors.add(:cards, 'cards must be an array of Card')
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/deck'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetDeck
14
+ class GetDeckResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :deck
20
+
21
+ validate :deck_is_a_deck
22
+
23
+ def initialize(response)
24
+ handle_errors(response)
25
+
26
+ @deck = ZombieBattleground::Api::Deck.new(JSON.parse(response.body))
27
+ end
28
+
29
+ def deck_is_a_deck
30
+ return if @deck.is_a?(ZombieBattleground::Api::Deck) &&
31
+ @deck.valid? &&
32
+ @deck.errors.size.zero?
33
+
34
+ errors.add(:deck, 'deck must be a Deck')
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/deck'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetDecks
14
+ class GetDecksResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :total, :page, :limit, :decks
20
+
21
+ validate :total_is_a_non_negative_integer
22
+ validate :page_is_a_non_negative_integer
23
+ validate :limit_is_a_non_negative_integer
24
+ validate :decks_is_an_array_of_deck
25
+
26
+ def initialize(response)
27
+ handle_errors(response)
28
+
29
+ JSON.parse(response.body).each do |key, value|
30
+ if key == 'decks'
31
+ instance_variable_set("@#{key}".to_sym, value.map { |deck| ZombieBattleground::Api::Deck.new(deck) })
32
+ else
33
+ instance_variable_set("@#{key}".to_sym, value)
34
+ end
35
+ end
36
+ end
37
+
38
+ def decks_is_an_array_of_deck
39
+ unless @decks.is_a?(Array)
40
+ errors.add(:decks, 'Decks must be an array')
41
+ return
42
+ end
43
+
44
+ @decks.each do |deck|
45
+ next if deck.is_a?(ZombieBattleground::Api::Deck) &&
46
+ deck.valid? &&
47
+ deck.errors.size.zero?
48
+
49
+ errors.add(:decks, 'decks must be an array of Deck')
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/match'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetMatch
14
+ class GetMatchResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :match
20
+
21
+ validate :match_is_a_match
22
+
23
+ def initialize(response)
24
+ handle_errors(response)
25
+
26
+ @match = ZombieBattleground::Api::Match.new(JSON.parse(response.body))
27
+ end
28
+
29
+ def match_is_a_match
30
+ return if @match.is_a?(ZombieBattleground::Api::Match) &&
31
+ @match.valid? &&
32
+ @match.errors.size.zero?
33
+
34
+ errors.add(:match, 'match must be a Match')
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+ require 'json'
5
+
6
+ require 'zombie_battleground/api/models/match'
7
+ require 'zombie_battleground/api/validation_helper'
8
+ require 'zombie_battleground/api/responses/response_helper'
9
+
10
+ module ZombieBattleground
11
+ class Api
12
+ ##
13
+ # Response validator for GetMatches
14
+ class GetMatchesResponse
15
+ include ActiveModel::Validations
16
+ include ZombieBattleground::Api::ValidationHelper
17
+ include ZombieBattleground::Api::ResponseHelper
18
+
19
+ attr_reader :total, :page, :limit, :matches
20
+
21
+ validate :total_is_a_non_negative_integer
22
+ validate :page_is_a_non_negative_integer
23
+ validate :limit_is_a_non_negative_integer
24
+ validate :matches_is_an_array_of_match
25
+
26
+ def initialize(response)
27
+ handle_errors(response)
28
+
29
+ JSON.parse(response.body).each do |key, value|
30
+ if key == 'matches'
31
+ instance_variable_set("@#{key}".to_sym, value.map { |match| ZombieBattleground::Api::Match.new(match) })
32
+ else
33
+ instance_variable_set("@#{key}".to_sym, value)
34
+ end
35
+ end
36
+ end
37
+
38
+ def matches_is_an_array_of_match
39
+ unless @matches.is_a?(Array)
40
+ errors.add(:matches, 'Matchs must be an array')
41
+ return
42
+ end
43
+
44
+ @matches.each do |match|
45
+ next if match.is_a?(ZombieBattleground::Api::Match) &&
46
+ match.valid? &&
47
+ match.errors.size.zero?
48
+
49
+ errors.add(:matches, 'matches must be an array of Match')
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zombie_battleground/api/errors'
4
+
5
+ module ZombieBattleground
6
+ class Api
7
+ ##
8
+ # Provides generic methods for response validator classes
9
+ module ResponseHelper
10
+ def handle_errors(response)
11
+ return if response.status == 200
12
+
13
+ case response.status
14
+ when 404
15
+ raise ZombieBattleground::Api::Errors::NotFound, response.body
16
+ when 503
17
+ raise ZombieBattleground::Api::Errors::ServiceUnavailable, response.body
18
+ when 400..499
19
+ raise ZombieBattleground::Api::Errors::BadRequest, response.body
20
+ when 500..599
21
+ raise ZombieBattleground::Api::Errors::InternalServerError, response.body
22
+ end
23
+
24
+ raise ZombieBattleground::Api::Errors::UnknownResponse, response.body
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,347 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZombieBattleground
4
+ class Api
5
+ ##
6
+ # Validation helpers for sanitizing inputs and ouputs
7
+ module ValidationHelper
8
+ def value_is_a_class(target:, value:, nullable:, klass:)
9
+ return if (nullable && value.nil?) || value.is_a?(klass)
10
+
11
+ errors.add(target, "#{target} must be a #{klass}")
12
+ end
13
+
14
+ def value_is_a_string(target:, value:, nullable: true)
15
+ value_is_a_class(
16
+ target: target,
17
+ value: value,
18
+ nullable: nullable,
19
+ klass: String
20
+ )
21
+ end
22
+
23
+ def value_is_a_time(target:, value:, nullable: true)
24
+ value_is_a_class(
25
+ target: target,
26
+ value: value,
27
+ nullable: nullable,
28
+ klass: Time
29
+ )
30
+ end
31
+
32
+ def value_is_an_integer(target:, value:, nullable: true)
33
+ value_is_a_class(
34
+ target: target,
35
+ value: value,
36
+ nullable: nullable,
37
+ klass: Integer
38
+ )
39
+ end
40
+
41
+ def value_is_a_non_negative_integer(target:, value:, nullable: true)
42
+ value_is_an_integer(target: target, value: value, nullable: nullable)
43
+ return unless errors.messages.empty?
44
+ return if nullable && value.nil?
45
+ return if value.zero? || value.positive?
46
+
47
+ errors.add(target, "#{target} must be not negative")
48
+ end
49
+
50
+ def id_is_a_non_negative_integer
51
+ value_is_a_non_negative_integer(target: :id, value: id)
52
+ end
53
+
54
+ def id_is_a_non_negative_integer_and_not_null
55
+ value_is_a_non_negative_integer(target: :id, value: id, nullable: false)
56
+ end
57
+
58
+ def user_id_is_a_string
59
+ value_is_a_string(target: :user_id, value: user_id)
60
+ end
61
+
62
+ def user_id_is_a_string_and_not_null
63
+ value_is_a_string(target: :user_id, value: user_id, nullable: false)
64
+ end
65
+
66
+ def deck_id_is_a_non_negative_integer
67
+ value_is_a_non_negative_integer(target: :deck_id, value: deck_id)
68
+ end
69
+
70
+ def deck_id_is_a_non_negative_integer_and_not_null
71
+ value_is_a_non_negative_integer(target: :deck_id, value: deck_id, nullable: false)
72
+ end
73
+
74
+ def name_is_a_string
75
+ value_is_a_string(target: :name, value: name)
76
+ end
77
+
78
+ def name_is_a_string_and_not_null
79
+ value_is_a_string(target: :name, value: name, nullable: false)
80
+ end
81
+
82
+ def hero_id_is_a_non_negative_integer
83
+ value_is_a_non_negative_integer(target: :hero_id, value: hero_id)
84
+ end
85
+
86
+ def hero_id_is_a_non_negative_integer_and_not_null
87
+ value_is_a_non_negative_integer(target: :hero_id, value: hero_id, nullable: false)
88
+ end
89
+
90
+ def primary_skill_id_is_a_non_negative_integer
91
+ value_is_a_non_negative_integer(target: :primary_skill_id, value: primary_skill_id)
92
+ end
93
+
94
+ def primary_skill_id_is_a_non_negative_integer_and_not_null
95
+ value_is_a_non_negative_integer(target: :primary_skill_id, value: primary_skill_id, nullable: false)
96
+ end
97
+
98
+ def secondary_skill_id_is_a_non_negative_integer
99
+ value_is_a_non_negative_integer(target: :secondary_skill_id, value: secondary_skill_id)
100
+ end
101
+
102
+ def secondary_skill_id_is_a_non_negative_integer_and_not_null
103
+ value_is_a_non_negative_integer(target: :secondary_skill_id, value: secondary_skill_id, nullable: false)
104
+ end
105
+
106
+ def version_is_a_string
107
+ value_is_a_string(target: :version, value: version)
108
+ end
109
+
110
+ def version_is_a_string_and_not_null
111
+ value_is_a_string(target: :version, value: version, nullable: false)
112
+ end
113
+
114
+ def total_is_a_non_negative_integer
115
+ value_is_a_non_negative_integer(target: :total, value: total)
116
+ end
117
+
118
+ def total_is_a_non_negative_integer_and_not_null
119
+ value_is_a_non_negative_integer(target: :total, value: total, nullable: false)
120
+ end
121
+
122
+ def page_is_a_non_negative_integer
123
+ value_is_a_non_negative_integer(target: :page, value: page)
124
+ end
125
+
126
+ def page_is_a_non_negative_integer_and_not_null
127
+ value_is_a_non_negative_integer(target: :page, value: page, nullable: false)
128
+ end
129
+
130
+ def limit_is_a_non_negative_integer
131
+ value_is_a_non_negative_integer(target: :limit, value: limit)
132
+ end
133
+
134
+ def limit_is_a_non_negative_integer_and_not_null
135
+ value_is_a_non_negative_integer(target: :limit, value: limit, nullable: false)
136
+ end
137
+
138
+ def card_name_is_a_string
139
+ value_is_a_string(target: :card_name, value: card_name)
140
+ end
141
+
142
+ def card_name_is_a_string_and_not_null
143
+ value_is_a_string(target: :card_name, value: card_name, nullable: false)
144
+ end
145
+
146
+ def amount_is_a_non_negative_integer
147
+ value_is_a_non_negative_integer(target: :amount, value: amount)
148
+ end
149
+
150
+ def amount_is_a_non_negative_integer_and_not_null
151
+ value_is_a_non_negative_integer(target: :amount, value: amount, nullable: false)
152
+ end
153
+
154
+ def sender_address_is_a_string
155
+ value_is_a_string(target: :sender_address, value: sender_address)
156
+ end
157
+
158
+ def sender_address_is_a_string_and_not_null
159
+ value_is_a_string(target: :sender_address, value: sender_address, nullable: false)
160
+ end
161
+
162
+ def created_at_is_a_time
163
+ value_is_a_time(target: :created_at, value: created_at)
164
+ end
165
+
166
+ def created_at_is_a_time_and_not_null
167
+ value_is_a_time(target: :created_at, value: created_at, nullable: false)
168
+ end
169
+
170
+ def updated_at_is_a_time
171
+ value_is_a_time(target: :updated_at, value: updated_at)
172
+ end
173
+
174
+ def updated_at_is_a_time_and_not_null
175
+ value_is_a_time(target: :updated_at, value: updated_at, nullable: false)
176
+ end
177
+
178
+ def block_height_is_a_non_negative_integer
179
+ value_is_a_non_negative_integer(target: :block_height, value: block_height)
180
+ end
181
+
182
+ def block_height_is_a_non_negative_integer_and_not_null
183
+ value_is_a_non_negative_integer(target: :block_height, value: block_height, nullable: false)
184
+ end
185
+
186
+ def player1_id_is_a_string
187
+ value_is_a_string(target: :player1_id, value: player1_id)
188
+ end
189
+
190
+ def player1_id_is_a_string_and_not_null
191
+ value_is_a_string(target: :player1_id, value: player1_id, nullable: false)
192
+ end
193
+
194
+ def player2_id_is_a_string
195
+ value_is_a_string(target: :player2_id, value: player2_id)
196
+ end
197
+
198
+ def player2_id_is_a_string_and_not_null
199
+ value_is_a_string(target: :player2_id, value: player2_id, nullable: false)
200
+ end
201
+
202
+ def player1_deck_id_is_a_non_negative_integer
203
+ value_is_a_non_negative_integer(target: :player1_deck_id, value: player1_deck_id)
204
+ end
205
+
206
+ def player1_deck_id_is_a_non_negative_integer_and_not_null
207
+ value_is_a_non_negative_integer(target: :player1_deck_id, value: player1_deck_id, nullable: false)
208
+ end
209
+
210
+ def player2_deck_id_is_a_non_negative_integer
211
+ value_is_a_non_negative_integer(target: :player2_deck_id, value: player2_deck_id)
212
+ end
213
+
214
+ def player2_deck_id_is_a_non_negative_integer_and_not_null
215
+ value_is_a_non_negative_integer(target: :player2_deck_id, value: player2_deck_id, nullable: false)
216
+ end
217
+
218
+ def random_seed_is_a_non_negative_integer
219
+ value_is_a_non_negative_integer(target: :random_seed, value: random_seed)
220
+ end
221
+
222
+ def random_seed_is_a_non_negative_integer_and_not_null
223
+ value_is_a_non_negative_integer(target: :random_seed, value: random_seed, nullable: false)
224
+ end
225
+
226
+ def status_is_a_string
227
+ value_is_a_string(target: :status, value: status)
228
+ end
229
+
230
+ def status_is_a_string_and_not_null
231
+ value_is_a_string(target: :status, value: status, nullable: false)
232
+ end
233
+
234
+ def winner_id_is_a_string
235
+ value_is_a_string(target: :winner_id, value: winner_id)
236
+ end
237
+
238
+ def winner_id_is_a_string_and_not_null
239
+ value_is_a_string(target: :winner_id, value: winner_id, nullable: false)
240
+ end
241
+
242
+ def mould_id_is_a_string
243
+ value_is_a_string(target: :mould_id, value: mould_id)
244
+ end
245
+
246
+ def mould_id_is_a_string_and_not_null
247
+ value_is_a_string(target: :mould_id, value: mould_id, nullable: false)
248
+ end
249
+
250
+ def kind_is_a_string
251
+ value_is_a_string(target: :kind, value: kind)
252
+ end
253
+
254
+ def kind_is_a_string_and_not_null
255
+ value_is_a_string(target: :kind, value: kind, nullable: false)
256
+ end
257
+
258
+ def set_is_a_string
259
+ value_is_a_string(target: :set, value: set)
260
+ end
261
+
262
+ def set_is_a_string_and_not_null
263
+ value_is_a_string(target: :set, value: set, nullable: false)
264
+ end
265
+
266
+ def description_is_a_string
267
+ value_is_a_string(target: :description, value: description)
268
+ end
269
+
270
+ def description_is_a_string_and_not_null
271
+ value_is_a_string(target: :description, value: description, nullable: false)
272
+ end
273
+
274
+ def rank_is_a_string
275
+ value_is_a_string(target: :rank, value: rank)
276
+ end
277
+
278
+ def rank_is_a_string_and_not_null
279
+ value_is_a_string(target: :rank, value: rank, nullable: false)
280
+ end
281
+
282
+ def type_is_a_string
283
+ value_is_a_string(target: :type, value: type)
284
+ end
285
+
286
+ def type_is_a_string_and_not_null
287
+ value_is_a_string(target: :type, value: type, nullable: false)
288
+ end
289
+
290
+ def rarity_is_a_string
291
+ value_is_a_string(target: :rarity, value: rarity)
292
+ end
293
+
294
+ def rarity_is_a_string_and_not_null
295
+ value_is_a_string(target: :rarity, value: rarity, nullable: false)
296
+ end
297
+
298
+ def frame_is_a_string
299
+ value_is_a_string(target: :frame, value: frame)
300
+ end
301
+
302
+ def frame_is_a_string_and_not_null
303
+ value_is_a_string(target: :frame, value: frame, nullable: false)
304
+ end
305
+
306
+ def damage_is_a_non_negative_integer
307
+ value_is_a_non_negative_integer(target: :damage, value: damage)
308
+ end
309
+
310
+ def damage_is_a_non_negative_integer_and_not_null
311
+ value_is_a_non_negative_integer(target: :damage, value: damage, nullable: false)
312
+ end
313
+
314
+ def health_is_a_non_negative_integer
315
+ value_is_a_non_negative_integer(target: :health, value: health)
316
+ end
317
+
318
+ def health_is_a_non_negative_integer_and_not_null
319
+ value_is_a_non_negative_integer(target: :health, value: health, nullable: false)
320
+ end
321
+
322
+ def cost_is_a_non_negative_integer
323
+ value_is_a_non_negative_integer(target: :cost, value: cost)
324
+ end
325
+
326
+ def cost_is_a_non_negative_integer_and_not_null
327
+ value_is_a_non_negative_integer(target: :cost, value: cost, nullable: false)
328
+ end
329
+
330
+ def ability_is_a_string
331
+ value_is_a_string(target: :ability, value: ability)
332
+ end
333
+
334
+ def ability_is_a_string_and_not_null
335
+ value_is_a_string(target: :ability, value: ability, nullable: false)
336
+ end
337
+
338
+ def image_url_is_a_string
339
+ value_is_a_string(target: :image_url, value: image_url)
340
+ end
341
+
342
+ def image_url_is_a_string_and_not_null
343
+ value_is_a_string(target: :image_url, value: image_url, nullable: false)
344
+ end
345
+ end
346
+ end
347
+ end