late-sdk 0.0.950 → 0.0.951

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/docs/AdCampaignsApi.md +154 -0
  4. data/docs/AdKeyword.md +3 -1
  5. data/docs/AdKeywordQuality.md +24 -0
  6. data/docs/AdScheduleWindow.md +32 -0
  7. data/docs/GetCampaignAdSchedule200Response.md +28 -0
  8. data/docs/GetCampaignAdSchedule200ResponsePerformance.md +22 -0
  9. data/docs/GetCampaignAdSchedule200ResponsePerformanceByDayOfWeekInner.md +26 -0
  10. data/docs/GetCampaignAdSchedule200ResponsePerformanceByHourInner.md +26 -0
  11. data/docs/UpdateCampaignAdSchedule200Response.md +22 -0
  12. data/docs/UpdateCampaignAdScheduleRequest.md +18 -0
  13. data/docs/UpdateCampaignAdScheduleRequestScheduleInner.md +28 -0
  14. data/lib/zernio-sdk/api/ad_campaigns_api.rb +164 -0
  15. data/lib/zernio-sdk/models/ad_keyword.rb +11 -2
  16. data/lib/zernio-sdk/models/ad_keyword_quality.rb +241 -0
  17. data/lib/zernio-sdk/models/ad_schedule_window.rb +329 -0
  18. data/lib/zernio-sdk/models/get_campaign_ad_schedule200_response.rb +197 -0
  19. data/lib/zernio-sdk/models/get_campaign_ad_schedule200_response_performance.rb +174 -0
  20. data/lib/zernio-sdk/models/get_campaign_ad_schedule200_response_performance_by_day_of_week_inner.rb +218 -0
  21. data/lib/zernio-sdk/models/get_campaign_ad_schedule200_response_performance_by_hour_inner.rb +212 -0
  22. data/lib/zernio-sdk/models/update_campaign_ad_schedule200_response.rb +167 -0
  23. data/lib/zernio-sdk/models/update_campaign_ad_schedule_request.rb +176 -0
  24. data/lib/zernio-sdk/models/update_campaign_ad_schedule_request_schedule_inner.rb +362 -0
  25. data/lib/zernio-sdk/version.rb +1 -1
  26. data/lib/zernio-sdk.rb +9 -0
  27. data/openapi.yaml +200 -1
  28. data/spec/api/ad_campaigns_api_spec.rb +30 -0
  29. data/spec/models/ad_keyword_quality_spec.rb +66 -0
  30. data/spec/models/ad_keyword_spec.rb +6 -0
  31. data/spec/models/ad_schedule_window_spec.rb +90 -0
  32. data/spec/models/get_campaign_ad_schedule200_response_performance_by_day_of_week_inner_spec.rb +64 -0
  33. data/spec/models/get_campaign_ad_schedule200_response_performance_by_hour_inner_spec.rb +60 -0
  34. data/spec/models/get_campaign_ad_schedule200_response_performance_spec.rb +48 -0
  35. data/spec/models/get_campaign_ad_schedule200_response_spec.rb +66 -0
  36. data/spec/models/update_campaign_ad_schedule200_response_spec.rb +48 -0
  37. data/spec/models/update_campaign_ad_schedule_request_schedule_inner_spec.rb +78 -0
  38. data/spec/models/update_campaign_ad_schedule_request_spec.rb +36 -0
  39. data/zernio-sdk-0.0.951.gem +0 -0
  40. metadata +38 -2
  41. data/zernio-sdk-0.0.950.gem +0 -0
@@ -1553,6 +1553,96 @@ module Zernio
1553
1553
  return data, status_code, headers
1554
1554
  end
1555
1555
 
1556
+ # Read a campaign's ad schedule (dayparting)
1557
+ # The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them. An EMPTY `schedule` is meaningful and is not a failed lookup: Google has no \"all day\" criterion, so a campaign with no ad schedule serves around the clock. `servesAroundTheClock` states that explicitly. Set `includePerformance=true` to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree. Google Ads only. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
1558
+ # @param campaign_id [String] Numeric Google platform campaign id.
1559
+ # @param [Hash] opts the optional parameters
1560
+ # @option opts [String] :platform Disambiguates the campaign id when the connection spans platforms.
1561
+ # @option opts [Boolean] :include_performance Also return delivery by day of week and by hour. Costs one extra Google call.
1562
+ # @option opts [Integer] :window_days Trailing window for the performance split. Ignored when fromDate and toDate are both given. (default to 30)
1563
+ # @option opts [Date] :from_date Start of an explicit performance range (YYYY-MM-DD). Use together with toDate.
1564
+ # @option opts [Date] :to_date End of an explicit performance range (YYYY-MM-DD). Must be on or after fromDate.
1565
+ # @return [GetCampaignAdSchedule200Response]
1566
+ def get_campaign_ad_schedule(campaign_id, opts = {})
1567
+ data, _status_code, _headers = get_campaign_ad_schedule_with_http_info(campaign_id, opts)
1568
+ data
1569
+ end
1570
+
1571
+ # Read a campaign's ad schedule (dayparting)
1572
+ # The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them. An EMPTY `schedule` is meaningful and is not a failed lookup: Google has no \"all day\" criterion, so a campaign with no ad schedule serves around the clock. `servesAroundTheClock` states that explicitly. Set `includePerformance=true` to also get delivery split by day of week and by hour, which is the evidence for deciding what the schedule should be. It is one extra Google call segmented by both dimensions at once, so the two views always agree. Google Ads only. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read.
1573
+ # @param campaign_id [String] Numeric Google platform campaign id.
1574
+ # @param [Hash] opts the optional parameters
1575
+ # @option opts [String] :platform Disambiguates the campaign id when the connection spans platforms.
1576
+ # @option opts [Boolean] :include_performance Also return delivery by day of week and by hour. Costs one extra Google call.
1577
+ # @option opts [Integer] :window_days Trailing window for the performance split. Ignored when fromDate and toDate are both given. (default to 30)
1578
+ # @option opts [Date] :from_date Start of an explicit performance range (YYYY-MM-DD). Use together with toDate.
1579
+ # @option opts [Date] :to_date End of an explicit performance range (YYYY-MM-DD). Must be on or after fromDate.
1580
+ # @return [Array<(GetCampaignAdSchedule200Response, Integer, Hash)>] GetCampaignAdSchedule200Response data, response status code and response headers
1581
+ def get_campaign_ad_schedule_with_http_info(campaign_id, opts = {})
1582
+ if @api_client.config.debugging
1583
+ @api_client.config.logger.debug 'Calling API: AdCampaignsApi.get_campaign_ad_schedule ...'
1584
+ end
1585
+ # verify the required parameter 'campaign_id' is set
1586
+ if @api_client.config.client_side_validation && campaign_id.nil?
1587
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.get_campaign_ad_schedule"
1588
+ end
1589
+ allowable_values = ["google"]
1590
+ if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
1591
+ fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
1592
+ end
1593
+ if @api_client.config.client_side_validation && !opts[:'window_days'].nil? && opts[:'window_days'] > 90
1594
+ fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling AdCampaignsApi.get_campaign_ad_schedule, must be smaller than or equal to 90.'
1595
+ end
1596
+
1597
+ if @api_client.config.client_side_validation && !opts[:'window_days'].nil? && opts[:'window_days'] < 1
1598
+ fail ArgumentError, 'invalid value for "opts[:"window_days"]" when calling AdCampaignsApi.get_campaign_ad_schedule, must be greater than or equal to 1.'
1599
+ end
1600
+
1601
+ # resource path
1602
+ local_var_path = '/v1/ads/campaigns/{campaignId}/ad-schedule'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
1603
+
1604
+ # query parameters
1605
+ query_params = opts[:query_params] || {}
1606
+ query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
1607
+ query_params[:'includePerformance'] = opts[:'include_performance'] if !opts[:'include_performance'].nil?
1608
+ query_params[:'windowDays'] = opts[:'window_days'] if !opts[:'window_days'].nil?
1609
+ query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
1610
+ query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
1611
+
1612
+ # header parameters
1613
+ header_params = opts[:header_params] || {}
1614
+ # HTTP header 'Accept' (if needed)
1615
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1616
+
1617
+ # form parameters
1618
+ form_params = opts[:form_params] || {}
1619
+
1620
+ # http body (model)
1621
+ post_body = opts[:debug_body]
1622
+
1623
+ # return_type
1624
+ return_type = opts[:debug_return_type] || 'GetCampaignAdSchedule200Response'
1625
+
1626
+ # auth_names
1627
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1628
+
1629
+ new_options = opts.merge(
1630
+ :operation => :"AdCampaignsApi.get_campaign_ad_schedule",
1631
+ :header_params => header_params,
1632
+ :query_params => query_params,
1633
+ :form_params => form_params,
1634
+ :body => post_body,
1635
+ :auth_names => auth_names,
1636
+ :return_type => return_type
1637
+ )
1638
+
1639
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1640
+ if @api_client.config.debugging
1641
+ @api_client.config.logger.debug "API called: AdCampaignsApi#get_campaign_ad_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1642
+ end
1643
+ return data, status_code, headers
1644
+ end
1645
+
1556
1646
  # Read a campaign's current bidding
1557
1647
  # Read of the campaign's bidding strategy on Google, cached for the quota window, for pre-filling the bid strategy block before a PUT to /v1/ads/campaigns/{campaignId}. Google Ads only; `platform` is required and rejected when it is anything else, since a `campaignId` is not globally unique. The response carries `cachedAt` and `stale`, set when a quota-exhausted call falls back to the last-good copy instead of a live read. Maps Google's bidding strategy onto the same triplet PUT accepts: `LOWEST_COST_WITHOUT_CAP` (Maximize Conversions, no target), `COST_CAP` + `bidAmount` (Target CPA), `LOWEST_COST_WITH_MIN_ROAS` + `roasAverageFloor` (Target ROAS), `LOWEST_COST_WITH_BID_CAP` + `bidAmount` (Maximize Clicks with a CPC ceiling). A campaign on a portfolio strategy returns `portfolio` (id + name) and `bidSpec.portfolioBidStrategyId` instead of the triplet. Anything else (Manual CPC, Target Impression Share, ...) returns `bidSpec: null`; show `biddingStrategyType` as-is.
1558
1648
  # @param campaign_id [String] Numeric Google platform campaign id.
@@ -3647,6 +3737,80 @@ module Zernio
3647
3737
  return data, status_code, headers
3648
3738
  end
3649
3739
 
3740
+ # Replace a campaign's ad schedule (dayparting)
3741
+ # Replaces the campaign's whole ad schedule with the windows you send. This is a REPLACE, not a merge: windows you leave out stop serving. Send `schedule: []` to clear dayparting, which returns the campaign to serving around the clock. Google rules enforced here, so you get a named field instead of a criterion error: at most 6 windows per day, a window must end after it starts, windows on the same day may not overlap, `endHour` 24 is midnight and cannot carry minutes, and minutes are quarter-hours only (0, 15, 30, 45). `bidModifier` is 0.1-10.0; Google's 0 means \"off\" for devices only, so a window is switched off by leaving it out. Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid. Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update), so this removes the live criteria and creates the new ones in a single atomic mutate. The response is read back from Google and carries the new criterion ids.
3742
+ # @param campaign_id [String] Numeric Google platform campaign id.
3743
+ # @param update_campaign_ad_schedule_request [UpdateCampaignAdScheduleRequest]
3744
+ # @param [Hash] opts the optional parameters
3745
+ # @return [UpdateCampaignAdSchedule200Response]
3746
+ def update_campaign_ad_schedule(campaign_id, update_campaign_ad_schedule_request, opts = {})
3747
+ data, _status_code, _headers = update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts)
3748
+ data
3749
+ end
3750
+
3751
+ # Replace a campaign&#39;s ad schedule (dayparting)
3752
+ # Replaces the campaign&#39;s whole ad schedule with the windows you send. This is a REPLACE, not a merge: windows you leave out stop serving. Send &#x60;schedule: []&#x60; to clear dayparting, which returns the campaign to serving around the clock. Google rules enforced here, so you get a named field instead of a criterion error: at most 6 windows per day, a window must end after it starts, windows on the same day may not overlap, &#x60;endHour&#x60; 24 is midnight and cannot carry minutes, and minutes are quarter-hours only (0, 15, 30, 45). &#x60;bidModifier&#x60; is 0.1-10.0; Google&#39;s 0 means \&quot;off\&quot; for devices only, so a window is switched off by leaving it out. Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid. Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update), so this removes the live criteria and creates the new ones in a single atomic mutate. The response is read back from Google and carries the new criterion ids.
3753
+ # @param campaign_id [String] Numeric Google platform campaign id.
3754
+ # @param update_campaign_ad_schedule_request [UpdateCampaignAdScheduleRequest]
3755
+ # @param [Hash] opts the optional parameters
3756
+ # @return [Array<(UpdateCampaignAdSchedule200Response, Integer, Hash)>] UpdateCampaignAdSchedule200Response data, response status code and response headers
3757
+ def update_campaign_ad_schedule_with_http_info(campaign_id, update_campaign_ad_schedule_request, opts = {})
3758
+ if @api_client.config.debugging
3759
+ @api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_campaign_ad_schedule ...'
3760
+ end
3761
+ # verify the required parameter 'campaign_id' is set
3762
+ if @api_client.config.client_side_validation && campaign_id.nil?
3763
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_campaign_ad_schedule"
3764
+ end
3765
+ # verify the required parameter 'update_campaign_ad_schedule_request' is set
3766
+ if @api_client.config.client_side_validation && update_campaign_ad_schedule_request.nil?
3767
+ fail ArgumentError, "Missing the required parameter 'update_campaign_ad_schedule_request' when calling AdCampaignsApi.update_campaign_ad_schedule"
3768
+ end
3769
+ # resource path
3770
+ local_var_path = '/v1/ads/campaigns/{campaignId}/ad-schedule'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
3771
+
3772
+ # query parameters
3773
+ query_params = opts[:query_params] || {}
3774
+
3775
+ # header parameters
3776
+ header_params = opts[:header_params] || {}
3777
+ # HTTP header 'Accept' (if needed)
3778
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3779
+ # HTTP header 'Content-Type'
3780
+ content_type = @api_client.select_header_content_type(['application/json'])
3781
+ if !content_type.nil?
3782
+ header_params['Content-Type'] = content_type
3783
+ end
3784
+
3785
+ # form parameters
3786
+ form_params = opts[:form_params] || {}
3787
+
3788
+ # http body (model)
3789
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_campaign_ad_schedule_request)
3790
+
3791
+ # return_type
3792
+ return_type = opts[:debug_return_type] || 'UpdateCampaignAdSchedule200Response'
3793
+
3794
+ # auth_names
3795
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
3796
+
3797
+ new_options = opts.merge(
3798
+ :operation => :"AdCampaignsApi.update_campaign_ad_schedule",
3799
+ :header_params => header_params,
3800
+ :query_params => query_params,
3801
+ :form_params => form_params,
3802
+ :body => post_body,
3803
+ :auth_names => auth_names,
3804
+ :return_type => return_type
3805
+ )
3806
+
3807
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
3808
+ if @api_client.config.debugging
3809
+ @api_client.config.logger.debug "API called: AdCampaignsApi#update_campaign_ad_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3810
+ end
3811
+ return data, status_code, headers
3812
+ end
3813
+
3650
3814
  # Update campaign assets
3651
3815
  # Edits existing Google assets in place. Send updates with assetResourceName and the fields to change. An asset is shared: changes affect every attachment using it. Omitted fields stay unchanged. The operation consumes the Google operations budget and invalidates affected cached lists.
3652
3816
  # @param campaign_id [String] Numeric Google platform id.
@@ -48,9 +48,11 @@ module Zernio
48
48
 
49
49
  attr_accessor :negative
50
50
 
51
- # Google Quality Score, 1-10. Null when unrated.
51
+ # Deprecated, use `quality.score`. Google Quality Score, 1-10. Null when unrated.
52
52
  attr_accessor :quality_score
53
53
 
54
+ attr_accessor :quality
55
+
54
56
  attr_accessor :synced_at
55
57
 
56
58
  attr_accessor :metrics
@@ -96,6 +98,7 @@ module Zernio
96
98
  :'status' => :'status',
97
99
  :'negative' => :'negative',
98
100
  :'quality_score' => :'qualityScore',
101
+ :'quality' => :'quality',
99
102
  :'synced_at' => :'syncedAt',
100
103
  :'metrics' => :'metrics'
101
104
  }
@@ -130,6 +133,7 @@ module Zernio
130
133
  :'status' => :'String',
131
134
  :'negative' => :'Boolean',
132
135
  :'quality_score' => :'Integer',
136
+ :'quality' => :'AdKeywordQuality',
133
137
  :'synced_at' => :'Time',
134
138
  :'metrics' => :'AdKeywordMetrics'
135
139
  }
@@ -227,6 +231,10 @@ module Zernio
227
231
  self.quality_score = attributes[:'quality_score']
228
232
  end
229
233
 
234
+ if attributes.key?(:'quality')
235
+ self.quality = attributes[:'quality']
236
+ end
237
+
230
238
  if attributes.key?(:'synced_at')
231
239
  self.synced_at = attributes[:'synced_at']
232
240
  end
@@ -308,6 +316,7 @@ module Zernio
308
316
  status == o.status &&
309
317
  negative == o.negative &&
310
318
  quality_score == o.quality_score &&
319
+ quality == o.quality &&
311
320
  synced_at == o.synced_at &&
312
321
  metrics == o.metrics
313
322
  end
@@ -321,7 +330,7 @@ module Zernio
321
330
  # Calculates hash code according to all attributes.
322
331
  # @return [Integer] Hash code
323
332
  def hash
324
- [id, account_id, profile_id, platform, ad_account_id, campaign_id, campaign_name, campaign_status, ad_set_id, ad_set_name, ad_set_status, keyword, match_type, status, negative, quality_score, synced_at, metrics].hash
333
+ [id, account_id, profile_id, platform, ad_account_id, campaign_id, campaign_name, campaign_status, ad_set_id, ad_set_name, ad_set_status, keyword, match_type, status, negative, quality_score, quality, synced_at, metrics].hash
325
334
  end
326
335
 
327
336
  # Builds the object from hash
@@ -0,0 +1,241 @@
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
+ # Google Quality Score and the three component ratings behind it (`ad_group_criterion.quality_info`). Every field is null until Google has rated the keyword: a keyword with too little traffic is unrated, and negatives are never rated. Google's own UNKNOWN / UNSPECIFIED buckets are reported as null so \"unrated\" has a single representation.
18
+ class AdKeywordQuality < ApiModelBase
19
+ # Quality Score, 1-10.
20
+ attr_accessor :score
21
+
22
+ # How the click-through rate compares with other ads in the same position (`search_predicted_ctr`).
23
+ attr_accessor :expected_ctr
24
+
25
+ # How closely the ad matches the intent behind the search (`creative_quality_score`).
26
+ attr_accessor :ad_relevance
27
+
28
+ # How relevant and useful the landing page is to people who click (`post_click_quality_score`).
29
+ attr_accessor :landing_page_experience
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'score' => :'score',
57
+ :'expected_ctr' => :'expectedCtr',
58
+ :'ad_relevance' => :'adRelevance',
59
+ :'landing_page_experience' => :'landingPageExperience'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'score' => :'Integer',
77
+ :'expected_ctr' => :'String',
78
+ :'ad_relevance' => :'String',
79
+ :'landing_page_experience' => :'String'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ :'score',
87
+ :'expected_ctr',
88
+ :'ad_relevance',
89
+ :'landing_page_experience'
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AdKeywordQuality` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AdKeywordQuality`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'score')
110
+ self.score = attributes[:'score']
111
+ end
112
+
113
+ if attributes.key?(:'expected_ctr')
114
+ self.expected_ctr = attributes[:'expected_ctr']
115
+ end
116
+
117
+ if attributes.key?(:'ad_relevance')
118
+ self.ad_relevance = attributes[:'ad_relevance']
119
+ end
120
+
121
+ if attributes.key?(:'landing_page_experience')
122
+ self.landing_page_experience = attributes[:'landing_page_experience']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ warn '[DEPRECATED] the `valid?` method is obsolete'
138
+ expected_ctr_validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
139
+ return false unless expected_ctr_validator.valid?(@expected_ctr)
140
+ ad_relevance_validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
141
+ return false unless ad_relevance_validator.valid?(@ad_relevance)
142
+ landing_page_experience_validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
143
+ return false unless landing_page_experience_validator.valid?(@landing_page_experience)
144
+ true
145
+ end
146
+
147
+ # Custom attribute writer method checking allowed values (enum).
148
+ # @param [Object] expected_ctr Object to be assigned
149
+ def expected_ctr=(expected_ctr)
150
+ validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
151
+ unless validator.valid?(expected_ctr)
152
+ fail ArgumentError, "invalid value for \"expected_ctr\", must be one of #{validator.allowable_values}."
153
+ end
154
+ @expected_ctr = expected_ctr
155
+ end
156
+
157
+ # Custom attribute writer method checking allowed values (enum).
158
+ # @param [Object] ad_relevance Object to be assigned
159
+ def ad_relevance=(ad_relevance)
160
+ validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
161
+ unless validator.valid?(ad_relevance)
162
+ fail ArgumentError, "invalid value for \"ad_relevance\", must be one of #{validator.allowable_values}."
163
+ end
164
+ @ad_relevance = ad_relevance
165
+ end
166
+
167
+ # Custom attribute writer method checking allowed values (enum).
168
+ # @param [Object] landing_page_experience Object to be assigned
169
+ def landing_page_experience=(landing_page_experience)
170
+ validator = EnumAttributeValidator.new('String', ["BELOW_AVERAGE", "AVERAGE", "ABOVE_AVERAGE"])
171
+ unless validator.valid?(landing_page_experience)
172
+ fail ArgumentError, "invalid value for \"landing_page_experience\", must be one of #{validator.allowable_values}."
173
+ end
174
+ @landing_page_experience = landing_page_experience
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ score == o.score &&
183
+ expected_ctr == o.expected_ctr &&
184
+ ad_relevance == o.ad_relevance &&
185
+ landing_page_experience == o.landing_page_experience
186
+ end
187
+
188
+ # @see the `==` method
189
+ # @param [Object] Object to be compared
190
+ def eql?(o)
191
+ self == o
192
+ end
193
+
194
+ # Calculates hash code according to all attributes.
195
+ # @return [Integer] Hash code
196
+ def hash
197
+ [score, expected_ctr, ad_relevance, landing_page_experience].hash
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def self.build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ attributes = attributes.transform_keys(&:to_sym)
206
+ transformed_hash = {}
207
+ openapi_types.each_pair do |key, type|
208
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
209
+ transformed_hash["#{key}"] = nil
210
+ elsif type =~ /\AArray<(.*)>/i
211
+ # check to ensure the input is an array given that the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[attribute_map[key]].is_a?(Array)
214
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
215
+ end
216
+ elsif !attributes[attribute_map[key]].nil?
217
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
218
+ end
219
+ end
220
+ new(transformed_hash)
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ end
240
+
241
+ end