late-sdk 0.0.856 → 0.0.858

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -2
  3. data/docs/AdCampaignsApi.md +364 -6
  4. data/docs/{ListAdKeywords200ResponseKeywordsInner.md → AdKeyword.md} +7 -3
  5. data/docs/AdKeywordMetrics.md +30 -0
  6. data/docs/AddAdKeywords201Response.md +18 -0
  7. data/docs/AddAdKeywordsRequest.md +24 -0
  8. data/docs/AddAdKeywordsRequestKeywordsInner.md +20 -0
  9. data/docs/AddAdKeywordsRequestKeywordsInnerAnyOf.md +20 -0
  10. data/docs/ChannelPicker.md +20 -0
  11. data/docs/ChannelPickerChannelsInner.md +24 -0
  12. data/docs/ChannelPickerTeam.md +22 -0
  13. data/docs/ConnectApi.md +78 -0
  14. data/docs/CreatePost200Response.md +22 -0
  15. data/docs/CreatePost200ResponseTiktokInner.md +24 -0
  16. data/docs/CreatePostRequest.md +2 -0
  17. data/docs/CreateStandaloneAdRequest.md +4 -2
  18. data/docs/KeywordEntry.md +49 -0
  19. data/docs/ListAdKeywords200Response.md +1 -1
  20. data/docs/ListCampaignNegativeKeywords200Response.md +18 -0
  21. data/docs/ListCampaignNegativeKeywords200ResponseKeywordsInner.md +22 -0
  22. data/docs/ListSlackChannels200Response.md +49 -0
  23. data/docs/PlatformTarget.md +1 -1
  24. data/docs/Post.md +1 -1
  25. data/docs/PostsApi.md +4 -4
  26. data/docs/RemoveAdKeyword200Response.md +20 -0
  27. data/docs/ReplaceCampaignNegativeKeywords200Response.md +22 -0
  28. data/docs/ReplaceCampaignNegativeKeywordsRequest.md +20 -0
  29. data/docs/StartOAuth.md +20 -0
  30. data/docs/UpdateAdKeyword200Response.md +18 -0
  31. data/docs/{UpdateAdStatusRequest.md → UpdateAdKeywordRequest.md} +2 -2
  32. data/docs/WebhookLog.md +1 -1
  33. data/lib/zernio-sdk/api/ad_campaigns_api.rb +358 -9
  34. data/lib/zernio-sdk/api/connect_api.rb +77 -0
  35. data/lib/zernio-sdk/api/posts_api.rb +4 -4
  36. data/lib/zernio-sdk/models/{list_ad_keywords200_response_keywords_inner.rb → ad_keyword.rb} +28 -8
  37. data/lib/zernio-sdk/models/ad_keyword_metrics.rb +207 -0
  38. data/lib/zernio-sdk/models/add_ad_keywords201_response.rb +149 -0
  39. data/lib/zernio-sdk/models/add_ad_keywords_request.rb +250 -0
  40. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner.rb +103 -0
  41. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner_any_of.rb +225 -0
  42. data/lib/zernio-sdk/models/channel_picker.rb +192 -0
  43. data/lib/zernio-sdk/models/channel_picker_channels_inner.rb +244 -0
  44. data/lib/zernio-sdk/models/channel_picker_team.rb +169 -0
  45. data/lib/zernio-sdk/models/create_post200_response.rb +221 -0
  46. data/lib/zernio-sdk/models/create_post200_response_tiktok_inner.rb +227 -0
  47. data/lib/zernio-sdk/models/create_post_request.rb +13 -1
  48. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +55 -5
  49. data/lib/zernio-sdk/models/keyword_entry.rb +105 -0
  50. data/lib/zernio-sdk/models/list_ad_keywords200_response.rb +1 -1
  51. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response.rb +149 -0
  52. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response_keywords_inner.rb +199 -0
  53. data/lib/zernio-sdk/models/list_slack_channels200_response.rb +104 -0
  54. data/lib/zernio-sdk/models/platform_target.rb +1 -1
  55. data/lib/zernio-sdk/models/post.rb +3 -2
  56. data/lib/zernio-sdk/models/remove_ad_keyword200_response.rb +157 -0
  57. data/lib/zernio-sdk/models/replace_campaign_negative_keywords200_response.rb +170 -0
  58. data/lib/zernio-sdk/models/replace_campaign_negative_keywords_request.rb +219 -0
  59. data/lib/zernio-sdk/models/start_o_auth.rb +190 -0
  60. data/lib/zernio-sdk/models/update_ad_keyword200_response.rb +147 -0
  61. data/lib/zernio-sdk/models/{update_ad_status_request.rb → update_ad_keyword_request.rb} +3 -3
  62. data/lib/zernio-sdk/models/webhook_log.rb +1 -1
  63. data/lib/zernio-sdk/version.rb +1 -1
  64. data/lib/zernio-sdk.rb +21 -2
  65. data/openapi.yaml +390 -27
  66. data/spec/api/ad_campaigns_api_spec.rb +64 -1
  67. data/spec/api/connect_api_spec.rb +15 -0
  68. data/spec/api/posts_api_spec.rb +1 -1
  69. data/spec/models/ad_keyword_metrics_spec.rb +72 -0
  70. data/spec/models/{list_ad_keywords200_response_keywords_inner_spec.rb → ad_keyword_spec.rb} +18 -6
  71. data/spec/models/add_ad_keywords201_response_spec.rb +36 -0
  72. data/spec/models/add_ad_keywords_request_keywords_inner_any_of_spec.rb +46 -0
  73. data/spec/models/add_ad_keywords_request_keywords_inner_spec.rb +21 -0
  74. data/spec/models/add_ad_keywords_request_spec.rb +54 -0
  75. data/spec/models/channel_picker_channels_inner_spec.rb +54 -0
  76. data/spec/models/channel_picker_spec.rb +42 -0
  77. data/spec/models/channel_picker_team_spec.rb +48 -0
  78. data/spec/models/create_post200_response_spec.rb +48 -0
  79. data/spec/models/create_post200_response_tiktok_inner_spec.rb +54 -0
  80. data/spec/models/create_post_request_spec.rb +6 -0
  81. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  82. data/spec/models/keyword_entry_spec.rb +32 -0
  83. data/spec/models/list_campaign_negative_keywords200_response_keywords_inner_spec.rb +52 -0
  84. data/spec/models/list_campaign_negative_keywords200_response_spec.rb +36 -0
  85. data/spec/models/list_slack_channels200_response_spec.rb +32 -0
  86. data/spec/models/post_spec.rb +1 -1
  87. data/spec/models/remove_ad_keyword200_response_spec.rb +42 -0
  88. data/spec/models/replace_campaign_negative_keywords200_response_spec.rb +48 -0
  89. data/spec/models/replace_campaign_negative_keywords_request_spec.rb +46 -0
  90. data/spec/models/start_o_auth_spec.rb +42 -0
  91. data/spec/models/update_ad_keyword200_response_spec.rb +36 -0
  92. data/spec/models/{update_ad_status_request_spec.rb → update_ad_keyword_request_spec.rb} +6 -6
  93. data/zernio-sdk-0.0.858.gem +0 -0
  94. metadata +86 -10
  95. data/zernio-sdk-0.0.856.gem +0 -0
@@ -0,0 +1,105 @@
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
+ # A Google Search keyword: a bare string (BROAD match), or an object naming the match type.
18
+ module KeywordEntry
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'AddAdKeywordsRequestKeywordsInnerAnyOf',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = Zernio.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -40,7 +40,7 @@ module Zernio
40
40
  # Attribute type mapping.
41
41
  def self.openapi_types
42
42
  {
43
- :'keywords' => :'Array<ListAdKeywords200ResponseKeywordsInner>',
43
+ :'keywords' => :'Array<AdKeyword>',
44
44
  :'pagination' => :'Pagination'
45
45
  }
46
46
  end
@@ -0,0 +1,149 @@
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 ListCampaignNegativeKeywords200Response < ApiModelBase
18
+ attr_accessor :keywords
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'keywords' => :'keywords'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'keywords' => :'Array<ListCampaignNegativeKeywords200ResponseKeywordsInner>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ListCampaignNegativeKeywords200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::ListCampaignNegativeKeywords200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'keywords')
67
+ if (value = attributes[:'keywords']).is_a?(Array)
68
+ self.keywords = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ keywords == o.keywords
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [keywords].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ if value.nil?
138
+ is_nullable = self.class.openapi_nullable.include?(attr)
139
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
140
+ end
141
+
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ end
148
+
149
+ end
@@ -0,0 +1,199 @@
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 ListCampaignNegativeKeywords200ResponseKeywordsInner < ApiModelBase
18
+ attr_accessor :criterion_id
19
+
20
+ attr_accessor :text
21
+
22
+ attr_accessor :match_type
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'criterion_id' => :'criterionId',
50
+ :'text' => :'text',
51
+ :'match_type' => :'matchType'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'criterion_id' => :'String',
69
+ :'text' => :'String',
70
+ :'match_type' => :'String'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ListCampaignNegativeKeywords200ResponseKeywordsInner` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ acceptable_attribute_map = self.class.acceptable_attribute_map
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!acceptable_attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::ListCampaignNegativeKeywords200ResponseKeywordsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'criterion_id')
97
+ self.criterion_id = attributes[:'criterion_id']
98
+ end
99
+
100
+ if attributes.key?(:'text')
101
+ self.text = attributes[:'text']
102
+ end
103
+
104
+ if attributes.key?(:'match_type')
105
+ self.match_type = attributes[:'match_type']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
113
+ invalid_properties = Array.new
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ match_type_validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
122
+ return false unless match_type_validator.valid?(@match_type)
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] match_type Object to be assigned
128
+ def match_type=(match_type)
129
+ validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
130
+ unless validator.valid?(match_type)
131
+ fail ArgumentError, "invalid value for \"match_type\", must be one of #{validator.allowable_values}."
132
+ end
133
+ @match_type = match_type
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ criterion_id == o.criterion_id &&
142
+ text == o.text &&
143
+ match_type == o.match_type
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [criterion_id, text, match_type].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ end
198
+
199
+ end
@@ -0,0 +1,104 @@
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
+ module ListSlackChannels200Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'ChannelPicker',
23
+ :'StartOAuth'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_one_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = Zernio.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -31,7 +31,7 @@ module Zernio
31
31
  # The platform-specific options stored on this target, echoed back as they were sent. Typed per platform on the way in (see the *PlatformData schemas on the request body); free-form on the way out, because a response is not guaranteed to match exactly one of those variants and generated clients that pick a variant by structure reject the entire response when it doesn't. Zernio's internal publishing state (snapshots, container ids, publish stage) is never returned here, and the key is omitted rather than sent as an empty object.
32
32
  attr_accessor :platform_specific_data
33
33
 
34
- # Platform-specific status: pending, publishing, published, failed
34
+ # Platform-specific status: pending, processing, uploading, published, failed, cancelled (removed from the platform via DELETE /v1/posts/{postId}/unpublish)
35
35
  attr_accessor :status
36
36
 
37
37
  # The native post ID on the platform (populated after successful publish)
@@ -32,6 +32,7 @@ module Zernio
32
32
 
33
33
  attr_accessor :timezone
34
34
 
35
+ # `cancelled` is set by DELETE /v1/posts/{postId}/unpublish once every platform entry has been removed from its platform (a post with published entries left becomes `partial`); cancelled posts can be edited and rescheduled like drafts.
35
36
  attr_accessor :status
36
37
 
37
38
  # YouTube constraints: each tag max 100 chars, combined max 500 chars, duplicates removed.
@@ -273,7 +274,7 @@ module Zernio
273
274
  # @return true if the model is valid
274
275
  def valid?
275
276
  warn '[DEPRECATED] the `valid?` method is obsolete'
276
- status_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "publishing", "published", "failed", "partial"])
277
+ status_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "publishing", "published", "partial", "failed", "cancelled"])
277
278
  return false unless status_validator.valid?(@status)
278
279
  visibility_validator = EnumAttributeValidator.new('String', ["public", "private", "unlisted"])
279
280
  return false unless visibility_validator.valid?(@visibility)
@@ -283,7 +284,7 @@ module Zernio
283
284
  # Custom attribute writer method checking allowed values (enum).
284
285
  # @param [Object] status Object to be assigned
285
286
  def status=(status)
286
- validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "publishing", "published", "failed", "partial"])
287
+ validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "publishing", "published", "partial", "failed", "cancelled"])
287
288
  unless validator.valid?(status)
288
289
  fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
289
290
  end