late-sdk 0.0.894 → 0.0.896

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -3
  3. data/docs/AdAccountsApi.md +446 -0
  4. data/docs/AdAnalyticsResponse.md +1 -1
  5. data/docs/AdAnalyticsResponseAnalytics.md +22 -0
  6. data/docs/AdCampaign.md +1 -1
  7. data/docs/AdCampaignBudget.md +11 -3
  8. data/docs/AdCampaignsApi.md +149 -3
  9. data/docs/AdInsightsApi.md +1 -1
  10. data/docs/AdNegativeKeywordList.md +26 -0
  11. data/docs/AdNegativeKeywordListKeyword.md +22 -0
  12. data/docs/BoostPostRequest.md +6 -4
  13. data/docs/CampaignAnalyticsResponseAnalytics.md +3 -1
  14. data/docs/CampaignAnalyticsResponseAnalyticsImpressionShareCache.md +20 -0
  15. data/docs/CampaignAnalyticsResponseAnalyticsSummary.md +96 -0
  16. data/docs/CampaignAnalyticsResponseCampaign.md +2 -0
  17. data/docs/CreateAdNegativeKeywordList201Response.md +24 -0
  18. data/docs/CreateAdNegativeKeywordListRequest.md +26 -0
  19. data/docs/CreateCallAdRequest.md +8 -2
  20. data/docs/CreateMessagingAdRequest.md +8 -2
  21. data/docs/CtwaAdRequestBody.md +8 -2
  22. data/docs/CtwaAdRequestBodyCreativesInner.md +7 -3
  23. data/docs/DeleteAdNegativeKeywordList200Response.md +20 -0
  24. data/docs/GetAdAnalytics202Response.md +1 -1
  25. data/docs/GetAdNegativeKeywordList200Response.md +24 -0
  26. data/docs/GetAdNegativeKeywordList200ResponseList.md +28 -0
  27. data/docs/ListAdNegativeKeywordLists200Response.md +24 -0
  28. data/docs/MediaItem.md +1 -1
  29. data/docs/MessagingAdsApi.md +10 -10
  30. data/docs/ReplaceAdNegativeKeywordListKeywords200Response.md +22 -0
  31. data/docs/ReplaceAdNegativeKeywordListKeywordsRequest.md +24 -0
  32. data/docs/ReplaceCampaignNegativeKeywordListsRequest.md +20 -0
  33. data/docs/UpdateAdCampaign200Response.md +1 -1
  34. data/docs/UpdateAdCampaignRequest.md +2 -0
  35. data/docs/UpdateAdNegativeKeywordList200Response.md +20 -0
  36. data/docs/UpdateAdNegativeKeywordListRequest.md +24 -0
  37. data/lib/zernio-sdk/api/ad_accounts_api.rb +500 -0
  38. data/lib/zernio-sdk/api/ad_campaigns_api.rb +160 -6
  39. data/lib/zernio-sdk/api/ad_insights_api.rb +2 -2
  40. data/lib/zernio-sdk/api/messaging_ads_api.rb +8 -8
  41. data/lib/zernio-sdk/models/ad_analytics_response.rb +1 -1
  42. data/lib/zernio-sdk/models/ad_analytics_response_analytics.rb +169 -0
  43. data/lib/zernio-sdk/models/ad_campaign.rb +3 -1
  44. data/lib/zernio-sdk/models/ad_campaign_budget.rb +99 -5
  45. data/lib/zernio-sdk/models/ad_negative_keyword_list.rb +209 -0
  46. data/lib/zernio-sdk/models/ad_negative_keyword_list_keyword.rb +222 -0
  47. data/lib/zernio-sdk/models/boost_post_request.rb +38 -7
  48. data/lib/zernio-sdk/models/campaign_analytics_response_analytics.rb +11 -2
  49. data/lib/zernio-sdk/models/campaign_analytics_response_analytics_impression_share_cache.rb +158 -0
  50. data/lib/zernio-sdk/models/campaign_analytics_response_analytics_summary.rb +550 -0
  51. data/lib/zernio-sdk/models/campaign_analytics_response_campaign.rb +11 -1
  52. data/lib/zernio-sdk/models/create_ad_negative_keyword_list201_response.rb +220 -0
  53. data/lib/zernio-sdk/models/create_ad_negative_keyword_list_request.rb +327 -0
  54. data/lib/zernio-sdk/models/create_call_ad_request.rb +94 -3
  55. data/lib/zernio-sdk/models/create_messaging_ad_request.rb +94 -3
  56. data/lib/zernio-sdk/models/ctwa_ad_request_body.rb +95 -4
  57. data/lib/zernio-sdk/models/ctwa_ad_request_body_creatives_inner.rb +67 -21
  58. data/lib/zernio-sdk/models/ctwa_ad_request_body_creatives_inner_video.rb +1 -1
  59. data/lib/zernio-sdk/models/ctwa_ad_request_body_video.rb +1 -1
  60. data/lib/zernio-sdk/models/{ad_campaign_campaign_budget.rb → delete_ad_negative_keyword_list200_response.rb} +35 -48
  61. data/lib/zernio-sdk/models/get_ad_analytics202_response.rb +1 -1
  62. data/lib/zernio-sdk/models/get_ad_negative_keyword_list200_response.rb +199 -0
  63. data/lib/zernio-sdk/models/get_ad_negative_keyword_list200_response_list.rb +227 -0
  64. data/lib/zernio-sdk/models/list_ad_negative_keyword_lists200_response.rb +201 -0
  65. data/lib/zernio-sdk/models/media_item.rb +1 -0
  66. data/lib/zernio-sdk/models/replace_ad_negative_keyword_list_keywords200_response.rb +189 -0
  67. data/lib/zernio-sdk/models/replace_ad_negative_keyword_list_keywords_request.rb +289 -0
  68. data/lib/zernio-sdk/models/replace_campaign_negative_keyword_lists_request.rb +219 -0
  69. data/lib/zernio-sdk/models/update_ad_campaign200_response.rb +1 -1
  70. data/lib/zernio-sdk/models/update_ad_campaign_request.rb +13 -1
  71. data/lib/zernio-sdk/models/update_ad_campaign_request_budget.rb +1 -1
  72. data/lib/zernio-sdk/models/update_ad_negative_keyword_list200_response.rb +178 -0
  73. data/lib/zernio-sdk/models/update_ad_negative_keyword_list_request.rb +296 -0
  74. data/lib/zernio-sdk/version.rb +1 -1
  75. data/lib/zernio-sdk.rb +16 -1
  76. data/openapi.yaml +981 -43
  77. data/spec/api/ad_accounts_api_spec.rb +82 -0
  78. data/spec/api/ad_campaigns_api_spec.rb +29 -3
  79. data/spec/api/ad_insights_api_spec.rb +1 -1
  80. data/spec/api/messaging_ads_api_spec.rb +4 -4
  81. data/spec/models/ad_analytics_response_analytics_spec.rb +48 -0
  82. data/spec/models/ad_campaign_budget_spec.rb +24 -0
  83. data/spec/models/ad_negative_keyword_list_keyword_spec.rb +52 -0
  84. data/spec/models/ad_negative_keyword_list_spec.rb +60 -0
  85. data/spec/models/boost_post_request_spec.rb +7 -1
  86. data/spec/models/campaign_analytics_response_analytics_impression_share_cache_spec.rb +42 -0
  87. data/spec/models/campaign_analytics_response_analytics_spec.rb +6 -0
  88. data/spec/models/campaign_analytics_response_analytics_summary_spec.rb +270 -0
  89. data/spec/models/campaign_analytics_response_campaign_spec.rb +6 -0
  90. data/spec/models/create_ad_negative_keyword_list201_response_spec.rb +54 -0
  91. data/spec/models/create_ad_negative_keyword_list_request_spec.rb +64 -0
  92. data/spec/models/create_call_ad_request_spec.rb +18 -0
  93. data/spec/models/create_messaging_ad_request_spec.rb +18 -0
  94. data/spec/models/ctwa_ad_request_body_creatives_inner_spec.rb +12 -0
  95. data/spec/models/ctwa_ad_request_body_spec.rb +18 -0
  96. data/spec/models/delete_ad_negative_keyword_list200_response_spec.rb +42 -0
  97. data/spec/models/get_ad_negative_keyword_list200_response_list_spec.rb +66 -0
  98. data/spec/models/get_ad_negative_keyword_list200_response_spec.rb +54 -0
  99. data/spec/models/list_ad_negative_keyword_lists200_response_spec.rb +54 -0
  100. data/spec/models/replace_ad_negative_keyword_list_keywords200_response_spec.rb +48 -0
  101. data/spec/models/replace_ad_negative_keyword_list_keywords_request_spec.rb +58 -0
  102. data/spec/models/{ad_campaign_campaign_budget_spec.rb → replace_campaign_negative_keyword_lists_request_spec.rb} +12 -12
  103. data/spec/models/update_ad_campaign_request_spec.rb +6 -0
  104. data/spec/models/update_ad_negative_keyword_list200_response_spec.rb +42 -0
  105. data/spec/models/update_ad_negative_keyword_list_request_spec.rb +58 -0
  106. data/zernio-sdk-0.0.896.gem +0 -0
  107. metadata +66 -6
  108. data/docs/AdCampaignCampaignBudget.md +0 -20
  109. data/zernio-sdk-0.0.894.gem +0 -0
@@ -14,12 +14,23 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- # Effective budget (back-compat). Use `budgetLevel` to disambiguate CBO vs ABO.
18
17
  class AdCampaignBudget < ApiModelBase
19
18
  attr_accessor :amount
20
19
 
21
20
  attr_accessor :type
22
21
 
22
+ # Google only. Exact decimal micros; DAILY uses amount_micros and CUSTOM_PERIOD uses total_amount_micros.
23
+ attr_accessor :amount_micros
24
+
25
+ # Google only. True for a shared budget; null when unavailable. Shared writes require allowSharedBudgetUpdate=true; unknown sharing status cannot be overridden.
26
+ attr_accessor :explicitly_shared
27
+
28
+ # Google only. campaign_budget.resource_name, or null when unavailable.
29
+ attr_accessor :resource_name
30
+
31
+ # Google only. campaign_budget.delivery_method, typically STANDARD, or null when unavailable.
32
+ attr_accessor :delivery_method
33
+
23
34
  class EnumAttributeValidator
24
35
  attr_reader :datatype
25
36
  attr_reader :allowable_values
@@ -46,7 +57,11 @@ module Zernio
46
57
  def self.attribute_map
47
58
  {
48
59
  :'amount' => :'amount',
49
- :'type' => :'type'
60
+ :'type' => :'type',
61
+ :'amount_micros' => :'amountMicros',
62
+ :'explicitly_shared' => :'explicitlyShared',
63
+ :'resource_name' => :'resourceName',
64
+ :'delivery_method' => :'deliveryMethod'
50
65
  }
51
66
  end
52
67
 
@@ -64,16 +79,30 @@ module Zernio
64
79
  def self.openapi_types
65
80
  {
66
81
  :'amount' => :'Float',
67
- :'type' => :'String'
82
+ :'type' => :'String',
83
+ :'amount_micros' => :'String',
84
+ :'explicitly_shared' => :'Boolean',
85
+ :'resource_name' => :'String',
86
+ :'delivery_method' => :'String'
68
87
  }
69
88
  end
70
89
 
71
90
  # List of attributes with nullable: true
72
91
  def self.openapi_nullable
73
92
  Set.new([
93
+ :'explicitly_shared',
94
+ :'resource_name',
95
+ :'delivery_method'
74
96
  ])
75
97
  end
76
98
 
99
+ # List of class defined in allOf (OpenAPI v3)
100
+ def self.openapi_all_of
101
+ [
102
+ :'AdBudget'
103
+ ]
104
+ end
105
+
77
106
  # Initializes the object
78
107
  # @param [Hash] attributes Model attributes in the form of hash
79
108
  def initialize(attributes = {})
@@ -92,10 +121,30 @@ module Zernio
92
121
 
93
122
  if attributes.key?(:'amount')
94
123
  self.amount = attributes[:'amount']
124
+ else
125
+ self.amount = nil
95
126
  end
96
127
 
97
128
  if attributes.key?(:'type')
98
129
  self.type = attributes[:'type']
130
+ else
131
+ self.type = nil
132
+ end
133
+
134
+ if attributes.key?(:'amount_micros')
135
+ self.amount_micros = attributes[:'amount_micros']
136
+ end
137
+
138
+ if attributes.key?(:'explicitly_shared')
139
+ self.explicitly_shared = attributes[:'explicitly_shared']
140
+ end
141
+
142
+ if attributes.key?(:'resource_name')
143
+ self.resource_name = attributes[:'resource_name']
144
+ end
145
+
146
+ if attributes.key?(:'delivery_method')
147
+ self.delivery_method = attributes[:'delivery_method']
99
148
  end
100
149
  end
101
150
 
@@ -104,6 +153,19 @@ module Zernio
104
153
  def list_invalid_properties
105
154
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
106
155
  invalid_properties = Array.new
156
+ if @amount.nil?
157
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
158
+ end
159
+
160
+ if @type.nil?
161
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
162
+ end
163
+
164
+ pattern = Regexp.new(/^\d+$/)
165
+ if !@amount_micros.nil? && @amount_micros !~ pattern
166
+ invalid_properties.push("invalid value for \"amount_micros\", must conform to the pattern #{pattern}.")
167
+ end
168
+
107
169
  invalid_properties
108
170
  end
109
171
 
@@ -111,11 +173,24 @@ module Zernio
111
173
  # @return true if the model is valid
112
174
  def valid?
113
175
  warn '[DEPRECATED] the `valid?` method is obsolete'
176
+ return false if @amount.nil?
177
+ return false if @type.nil?
114
178
  type_validator = EnumAttributeValidator.new('String', ["daily", "lifetime"])
115
179
  return false unless type_validator.valid?(@type)
180
+ return false if !@amount_micros.nil? && @amount_micros !~ Regexp.new(/^\d+$/)
116
181
  true
117
182
  end
118
183
 
184
+ # Custom attribute writer method with validation
185
+ # @param [Object] amount Value to be assigned
186
+ def amount=(amount)
187
+ if amount.nil?
188
+ fail ArgumentError, 'amount cannot be nil'
189
+ end
190
+
191
+ @amount = amount
192
+ end
193
+
119
194
  # Custom attribute writer method checking allowed values (enum).
120
195
  # @param [Object] type Object to be assigned
121
196
  def type=(type)
@@ -126,13 +201,32 @@ module Zernio
126
201
  @type = type
127
202
  end
128
203
 
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] amount_micros Value to be assigned
206
+ def amount_micros=(amount_micros)
207
+ if amount_micros.nil?
208
+ fail ArgumentError, 'amount_micros cannot be nil'
209
+ end
210
+
211
+ pattern = Regexp.new(/^\d+$/)
212
+ if amount_micros !~ pattern
213
+ fail ArgumentError, "invalid value for \"amount_micros\", must conform to the pattern #{pattern}."
214
+ end
215
+
216
+ @amount_micros = amount_micros
217
+ end
218
+
129
219
  # Checks equality by comparing each attribute.
130
220
  # @param [Object] Object to be compared
131
221
  def ==(o)
132
222
  return true if self.equal?(o)
133
223
  self.class == o.class &&
134
224
  amount == o.amount &&
135
- type == o.type
225
+ type == o.type &&
226
+ amount_micros == o.amount_micros &&
227
+ explicitly_shared == o.explicitly_shared &&
228
+ resource_name == o.resource_name &&
229
+ delivery_method == o.delivery_method
136
230
  end
137
231
 
138
232
  # @see the `==` method
@@ -144,7 +238,7 @@ module Zernio
144
238
  # Calculates hash code according to all attributes.
145
239
  # @return [Integer] Hash code
146
240
  def hash
147
- [amount, type].hash
241
+ [amount, type, amount_micros, explicitly_shared, resource_name, delivery_method].hash
148
242
  end
149
243
 
150
244
  # Builds the object from hash
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class AdNegativeKeywordList < ApiModelBase
18
+ # Google shared set id.
19
+ attr_accessor :id
20
+
21
+ # Google shared set resource name.
22
+ attr_accessor :resource_name
23
+
24
+ # List name.
25
+ attr_accessor :name
26
+
27
+ # Number of keywords in the list.
28
+ attr_accessor :member_count
29
+
30
+ # Number of resources referencing the list.
31
+ attr_accessor :reference_count
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'id' => :'id',
37
+ :'resource_name' => :'resourceName',
38
+ :'name' => :'name',
39
+ :'member_count' => :'memberCount',
40
+ :'reference_count' => :'referenceCount'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'id' => :'String',
58
+ :'resource_name' => :'String',
59
+ :'name' => :'String',
60
+ :'member_count' => :'Integer',
61
+ :'reference_count' => :'Integer'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AdNegativeKeywordList` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AdNegativeKeywordList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.key?(:'resource_name')
92
+ self.resource_name = attributes[:'resource_name']
93
+ end
94
+
95
+ if attributes.key?(:'name')
96
+ self.name = attributes[:'name']
97
+ end
98
+
99
+ if attributes.key?(:'member_count')
100
+ self.member_count = attributes[:'member_count']
101
+ end
102
+
103
+ if attributes.key?(:'reference_count')
104
+ self.reference_count = attributes[:'reference_count']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ pattern = Regexp.new(/^\d+$/)
114
+ if !@id.nil? && @id !~ pattern
115
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] id Value to be assigned
131
+ def id=(id)
132
+ if id.nil?
133
+ fail ArgumentError, 'id cannot be nil'
134
+ end
135
+
136
+ pattern = Regexp.new(/^\d+$/)
137
+ if id !~ pattern
138
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
139
+ end
140
+
141
+ @id = id
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ id == o.id &&
150
+ resource_name == o.resource_name &&
151
+ name == o.name &&
152
+ member_count == o.member_count &&
153
+ reference_count == o.reference_count
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [id, resource_name, name, member_count, reference_count].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ transformed_hash = {}
175
+ openapi_types.each_pair do |key, type|
176
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = nil
178
+ elsif type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[attribute_map[key]].is_a?(Array)
182
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
183
+ end
184
+ elsif !attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
186
+ end
187
+ end
188
+ new(transformed_hash)
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ end
208
+
209
+ end
@@ -0,0 +1,222 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class AdNegativeKeywordListKeyword < ApiModelBase
18
+ # Google shared criterion id.
19
+ attr_accessor :criterion_id
20
+
21
+ # Keyword text.
22
+ attr_accessor :text
23
+
24
+ attr_accessor :match_type
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'criterion_id' => :'criterionId',
52
+ :'text' => :'text',
53
+ :'match_type' => :'matchType'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'criterion_id' => :'String',
71
+ :'text' => :'String',
72
+ :'match_type' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AdNegativeKeywordListKeyword` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AdNegativeKeywordListKeyword`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'criterion_id')
99
+ self.criterion_id = attributes[:'criterion_id']
100
+ end
101
+
102
+ if attributes.key?(:'text')
103
+ self.text = attributes[:'text']
104
+ end
105
+
106
+ if attributes.key?(:'match_type')
107
+ self.match_type = attributes[:'match_type']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
+ invalid_properties = Array.new
116
+ pattern = Regexp.new(/^\d+$/)
117
+ if !@criterion_id.nil? && @criterion_id !~ pattern
118
+ invalid_properties.push("invalid value for \"criterion_id\", must conform to the pattern #{pattern}.")
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
128
+ return false if !@criterion_id.nil? && @criterion_id !~ Regexp.new(/^\d+$/)
129
+ match_type_validator = EnumAttributeValidator.new('String', ["broad", "phrase", "exact"])
130
+ return false unless match_type_validator.valid?(@match_type)
131
+ true
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] criterion_id Value to be assigned
136
+ def criterion_id=(criterion_id)
137
+ if criterion_id.nil?
138
+ fail ArgumentError, 'criterion_id cannot be nil'
139
+ end
140
+
141
+ pattern = Regexp.new(/^\d+$/)
142
+ if criterion_id !~ pattern
143
+ fail ArgumentError, "invalid value for \"criterion_id\", must conform to the pattern #{pattern}."
144
+ end
145
+
146
+ @criterion_id = criterion_id
147
+ end
148
+
149
+ # Custom attribute writer method checking allowed values (enum).
150
+ # @param [Object] match_type Object to be assigned
151
+ def match_type=(match_type)
152
+ validator = EnumAttributeValidator.new('String', ["broad", "phrase", "exact"])
153
+ unless validator.valid?(match_type)
154
+ fail ArgumentError, "invalid value for \"match_type\", must be one of #{validator.allowable_values}."
155
+ end
156
+ @match_type = match_type
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ criterion_id == o.criterion_id &&
165
+ text == o.text &&
166
+ match_type == o.match_type
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Integer] Hash code
177
+ def hash
178
+ [criterion_id, text, match_type].hash
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def self.build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ attributes = attributes.transform_keys(&:to_sym)
187
+ transformed_hash = {}
188
+ openapi_types.each_pair do |key, type|
189
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = nil
191
+ elsif type =~ /\AArray<(.*)>/i
192
+ # check to ensure the input is an array given that the attribute
193
+ # is documented as an array but the input is not
194
+ if attributes[attribute_map[key]].is_a?(Array)
195
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
196
+ end
197
+ elsif !attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
199
+ end
200
+ end
201
+ new(transformed_hash)
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ end
221
+
222
+ end