Class: SiteimproveAPIClient::KeywordMonitoringKeyword

Inherits:
Object
  • Object
show all
Defined in:
lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ KeywordMonitoringKeyword

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 128

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SiteimproveAPIClient::KeywordMonitoringKeyword` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `SiteimproveAPIClient::KeywordMonitoringKeyword`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'database')
    self.database = attributes[:'database']
  else
    self.database = 'unknown'
  end

  if attributes.key?(:'estimated_traffic')
    self.estimated_traffic = attributes[:'estimated_traffic']
  end

  if attributes.key?(:'keyword')
    self.keyword = attributes[:'keyword']
  end

  if attributes.key?(:'organic_competition')
    self.organic_competition = attributes[:'organic_competition']
  else
    self.organic_competition = 'low'
  end

  if attributes.key?(:'page_id')
    self.page_id = attributes[:'page_id']
  end

  if attributes.key?(:'page_views')
    self.page_views = attributes[:'page_views']
  end

  if attributes.key?(:'position')
    self.position = attributes[:'position']
  end

  if attributes.key?(:'ranking_pages')
    self.ranking_pages = attributes[:'ranking_pages']
  end

  if attributes.key?(:'search_volume')
    self.search_volume = attributes[:'search_volume']
  end

  if attributes.key?(:'seo_page_score')
    self.seo_page_score = attributes[:'seo_page_score']
  end

  if attributes.key?(:'target_url')
    self.target_url = attributes[:'target_url']
  end

  if attributes.key?(:'_links')
    self._links = attributes[:'_links']
  end
end

Instance Attribute Details

Returns the value of attribute _links.



53
54
55
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 53

def _links
  @_links
end

#databaseObject

The database for the keyword



22
23
24
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 22

def database
  @database
end

#estimated_trafficObject

Estimated traffic for the keyword



25
26
27
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 25

def estimated_traffic
  @estimated_traffic
end

#idObject

The id of the keyword



19
20
21
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 19

def id
  @id
end

#keywordObject

The keyword string



28
29
30
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 28

def keyword
  @keyword
end

#organic_competitionObject

The organic competition for the keyword



31
32
33
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 31

def organic_competition
  @organic_competition
end

#page_idObject

The page id of the target URL



34
35
36
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 34

def page_id
  @page_id
end

#page_viewsObject

Number of times this page has been viewed



37
38
39
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 37

def page_views
  @page_views
end

#positionObject

The position of the keyword and URL combination, null if it’s out of top 100



40
41
42
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 40

def position
  @position
end

#ranking_pagesObject

The number of ranking pages for this keyword



43
44
45
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 43

def ranking_pages
  @ranking_pages
end

#search_volumeObject

Returns the value of attribute search_volume.



45
46
47
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 45

def search_volume
  @search_volume
end

#seo_page_scoreObject

The SEO score for the page



48
49
50
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 48

def seo_page_score
  @seo_page_score
end

#target_urlObject

The target URL for the keyword



51
52
53
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 51

def target_url
  @target_url
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



97
98
99
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 97

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 78

def self.attribute_map
  {
    :'id' => :'id',
    :'database' => :'database',
    :'estimated_traffic' => :'estimated_traffic',
    :'keyword' => :'keyword',
    :'organic_competition' => :'organic_competition',
    :'page_id' => :'page_id',
    :'page_views' => :'page_views',
    :'position' => :'position',
    :'ranking_pages' => :'ranking_pages',
    :'search_volume' => :'search_volume',
    :'seo_page_score' => :'seo_page_score',
    :'target_url' => :'target_url',
    :'_links' => :'_links'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



295
296
297
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 295

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



121
122
123
124
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 121

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 102

def self.openapi_types
  {
    :'id' => :'Integer',
    :'database' => :'String',
    :'estimated_traffic' => :'Integer',
    :'keyword' => :'String',
    :'organic_competition' => :'String',
    :'page_id' => :'Integer',
    :'page_views' => :'Integer',
    :'position' => :'Integer',
    :'ranking_pages' => :'Integer',
    :'search_volume' => :'ValueOfMax',
    :'seo_page_score' => :'Float',
    :'target_url' => :'String',
    :'_links' => :'Links62'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 262

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      database == o.database &&
      estimated_traffic == o.estimated_traffic &&
      keyword == o.keyword &&
      organic_competition == o.organic_competition &&
      page_id == o.page_id &&
      page_views == o.page_views &&
      position == o.position &&
      ranking_pages == o.ranking_pages &&
      search_volume == o.search_volume &&
      seo_page_score == o.seo_page_score &&
      target_url == o.target_url &&
      _links == o._links
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 326

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = SiteimproveAPIClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 397

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 302

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


282
283
284
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 282

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



288
289
290
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 288

def hash
  [id, database, estimated_traffic, keyword, organic_competition, page_id, page_views, position, ranking_pages, search_volume, seo_page_score, target_url, _links].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 200

def list_invalid_properties
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @database.nil?
    invalid_properties.push('invalid value for "database", database cannot be nil.')
  end

  if @estimated_traffic.nil?
    invalid_properties.push('invalid value for "estimated_traffic", estimated_traffic cannot be nil.')
  end

  if @organic_competition.nil?
    invalid_properties.push('invalid value for "organic_competition", organic_competition cannot be nil.')
  end

  if @ranking_pages.nil?
    invalid_properties.push('invalid value for "ranking_pages", ranking_pages cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



373
374
375
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 373

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 379

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



367
368
369
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 367

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/siteimprove_api_client/models/keyword_monitoring_keyword.rb', line 227

def valid?
  return false if @id.nil?
  return false if @database.nil?
  database_validator = EnumAttributeValidator.new('String', ["unknown", "bing_united_states", "google_united_arab_emirates", "google_afghanistan", "google_albania", "google_armenia", "google_angola", "google_austria", "google_azerbaijan", "google_bosniaand_herzegovina", "google_bangladesh", "google_belgium", "google_bulgaria", "google_bahrain", "google_brunei", "google_bolivia", "google_botswana", "google_belarus", "google_belize", "google_canada", "google_democratic_republicofthe_congo", "google_switzerland", "google_chile", "google_cameroon", "google_colombia", "google_israel", "google_india", "google_japan", "google_argentina", "google_australia", "google_brazil", "google_hong_kong", "google_mexico", "google_singapore", "google_turkey", "google_united_states", "google_united_kingdom", "google_costa_rica", "google_cape_verde", "google_cyprus", "google_czech_republic", "google_germany", "google_denmark", "google_dominican_republic", "google_algeria", "google_ecuador", "google_estonia", "google_egypt", "google_spain", "google_ethiopia", "google_finland", "google_france", "google_georgia", "google_ghana", "google_greece", "google_guatemala", "google_guyana", "google_honduras", "google_croatia", "google_haiti", "google_hungary", "google_indonesia", "google_ireland", "google_iceland", "google_italy", "google_jamaica", "google_jordan", "google_cambodia", "google_south_korea", "google_kuwait", "google_kazakhstan", "google_lebanon", "google_sri_lanka", "google_lithuania", "google_luxembourg", "google_latvia", "google_libya", "google_morocco", "google_moldova", "google_montenegro", "google_madagascar", "google_mongolia", "google_malta", "google_mauritius", "google_malaysia", "google_mozambique", "google_namibia", "google_nigeria", "google_nicaragua", "google_netherlands", "google_norway", "google_nepal", "google_new_zealand", "google_oman", "google_peru", "google_philippines", "google_poland", "google_portugal", "google_paraguay", "google_romania", "google_serbia", "google_russia", "google_saudi_arabia", "google_sweden", "google_slovenia", "google_slovakia", "google_senegal", "google_el_salvador", "google_thailand", "google_tunisia", "google_trinidadand_tobago", "google_ukraine", "google_uruguay", "google_venezuela", "google_vietnam", "google_south_africa", "google_zambia", "google_zimbabwe", "google_mobile_canada", "google_mobile_indonesia", "google_mobile_israel", "google_mobile_india", "google_mobile_australia", "google_mobile_brazil", "google_mobile_united_states", "google_mobile_mexico", "google_mobile_turkey", "google_mobile_united_kingdom", "google_mobile_germany", "google_mobile_denmark", "google_mobile_spain", "google_mobile_france", "google_mobile_italy", "google_mobile_netherlands", "google_mobile_sweden", "google_mobile_slovakia", "google_mobile_romania", "google_mobile_greece", "google_mobile_colombia"])
  return false unless database_validator.valid?(@database)
  return false if @estimated_traffic.nil?
  return false if @organic_competition.nil?
  organic_competition_validator = EnumAttributeValidator.new('String', ["low", "medium", "high", "very_high"])
  return false unless organic_competition_validator.valid?(@organic_competition)
  return false if @ranking_pages.nil?
  true
end