Class: Hubspot::Cms::Domains::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/cms/domains/models/domain.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Domain

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 133

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::Domains::Domain` 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 `Hubspot::Cms::Domains::Domain`. 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?(:'is_used_for_landing_page')
    self.is_used_for_landing_page = attributes[:'is_used_for_landing_page']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#correct_cnameObject

Returns the value of attribute correct_cname.



60
61
62
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 60

def correct_cname
  @correct_cname
end

#createdObject

Returns the value of attribute created.



27
28
29
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 27

def created
  @created
end

#domainObject

The actual domain or sub-domain. e.g. www.hubspot.com



51
52
53
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 51

def domain
  @domain
end

#idObject

The unique ID of this domain.



58
59
60
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 58

def id
  @id
end

#is_resolvingObject

Whether the DNS for this domain is optimally configured for use with HubSpot.



43
44
45
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 43

def is_resolving
  @is_resolving
end

#is_ssl_enabledObject

Returns the value of attribute is_ssl_enabled.



45
46
47
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 45

def is_ssl_enabled
  @is_ssl_enabled
end

#is_ssl_onlyObject

Returns the value of attribute is_ssl_only.



62
63
64
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 62

def is_ssl_only
  @is_ssl_only
end

#is_used_for_blog_postObject

Whether the domain is used for CMS blog posts.



37
38
39
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 37

def is_used_for_blog_post
  @is_used_for_blog_post
end

#is_used_for_emailObject

Whether the domain is used for CMS email web pages.



48
49
50
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 48

def is_used_for_email
  @is_used_for_email
end

#is_used_for_knowledgeObject

Whether the domain is used for CMS knowledge pages.



34
35
36
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 34

def is_used_for_knowledge
  @is_used_for_knowledge
end

#is_used_for_landing_pageObject

Whether the domain is used for CMS landing pages.



21
22
23
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 21

def is_used_for_landing_page
  @is_used_for_landing_page
end

#is_used_for_site_pageObject

Whether the domain is used for CMS site pages.



40
41
42
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 40

def is_used_for_site_page
  @is_used_for_site_page
end

#manually_marked_as_resolvingObject

Returns the value of attribute manually_marked_as_resolving.



31
32
33
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 31

def manually_marked_as_resolving
  @manually_marked_as_resolving
end

#primary_blog_postObject

Returns the value of attribute primary_blog_post.



23
24
25
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 23

def primary_blog_post
  @primary_blog_post
end

#primary_emailObject

Returns the value of attribute primary_email.



66
67
68
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 66

def primary_email
  @primary_email
end

#primary_knowledgeObject

Returns the value of attribute primary_knowledge.



25
26
27
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 25

def primary_knowledge
  @primary_knowledge
end

#primary_landing_pageObject

Returns the value of attribute primary_landing_page.



55
56
57
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 55

def primary_landing_page
  @primary_landing_page
end

#primary_site_pageObject

Returns the value of attribute primary_site_page.



53
54
55
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 53

def primary_site_page
  @primary_site_page
end

#secondary_to_domainObject

Returns the value of attribute secondary_to_domain.



29
30
31
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 29

def secondary_to_domain
  @secondary_to_domain
end

#updatedObject

Returns the value of attribute updated.



64
65
66
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 64

def updated
  @updated
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 95

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 69

def self.attribute_map
  {
    :'is_used_for_landing_page' => :'isUsedForLandingPage',
    :'primary_blog_post' => :'primaryBlogPost',
    :'primary_knowledge' => :'primaryKnowledge',
    :'created' => :'created',
    :'secondary_to_domain' => :'secondaryToDomain',
    :'manually_marked_as_resolving' => :'manuallyMarkedAsResolving',
    :'is_used_for_knowledge' => :'isUsedForKnowledge',
    :'is_used_for_blog_post' => :'isUsedForBlogPost',
    :'is_used_for_site_page' => :'isUsedForSitePage',
    :'is_resolving' => :'isResolving',
    :'is_ssl_enabled' => :'isSslEnabled',
    :'is_used_for_email' => :'isUsedForEmail',
    :'domain' => :'domain',
    :'primary_site_page' => :'primarySitePage',
    :'primary_landing_page' => :'primaryLandingPage',
    :'id' => :'id',
    :'correct_cname' => :'correctCname',
    :'is_ssl_only' => :'isSslOnly',
    :'updated' => :'updated',
    :'primary_email' => :'primaryEmail'
  }
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



322
323
324
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 322

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

.openapi_nullableObject

List of attributes with nullable: true



126
127
128
129
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 126

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

.openapi_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 100

def self.openapi_types
  {
    :'is_used_for_landing_page' => :'Boolean',
    :'primary_blog_post' => :'Boolean',
    :'primary_knowledge' => :'Boolean',
    :'created' => :'Time',
    :'secondary_to_domain' => :'String',
    :'manually_marked_as_resolving' => :'Boolean',
    :'is_used_for_knowledge' => :'Boolean',
    :'is_used_for_blog_post' => :'Boolean',
    :'is_used_for_site_page' => :'Boolean',
    :'is_resolving' => :'Boolean',
    :'is_ssl_enabled' => :'Boolean',
    :'is_used_for_email' => :'Boolean',
    :'domain' => :'String',
    :'primary_site_page' => :'Boolean',
    :'primary_landing_page' => :'Boolean',
    :'id' => :'String',
    :'correct_cname' => :'String',
    :'is_ssl_only' => :'Boolean',
    :'updated' => :'Time',
    :'primary_email' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 282

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      is_used_for_landing_page == o.is_used_for_landing_page &&
      primary_blog_post == o.primary_blog_post &&
      primary_knowledge == o.primary_knowledge &&
      created == o.created &&
      secondary_to_domain == o.secondary_to_domain &&
      manually_marked_as_resolving == o.manually_marked_as_resolving &&
      is_used_for_knowledge == o.is_used_for_knowledge &&
      is_used_for_blog_post == o.is_used_for_blog_post &&
      is_used_for_site_page == o.is_used_for_site_page &&
      is_resolving == o.is_resolving &&
      is_ssl_enabled == o.is_ssl_enabled &&
      is_used_for_email == o.is_used_for_email &&
      domain == o.domain &&
      primary_site_page == o.primary_site_page &&
      primary_landing_page == o.primary_landing_page &&
      id == o.id &&
      correct_cname == o.correct_cname &&
      is_ssl_only == o.is_ssl_only &&
      updated == o.updated &&
      primary_email == o.primary_email
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



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 353

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 = Hubspot::Cms::Domains.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



424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 424

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



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 329

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


309
310
311
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 309

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



315
316
317
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 315

def hash
  [is_used_for_landing_page, primary_blog_post, primary_knowledge, created, secondary_to_domain, manually_marked_as_resolving, is_used_for_knowledge, is_used_for_blog_post, is_used_for_site_page, is_resolving, is_ssl_enabled, is_used_for_email, domain, primary_site_page, primary_landing_page, id, correct_cname, is_ssl_only, updated, primary_email].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 229

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

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

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

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

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

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

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

  if @id.nil?
    invalid_properties.push('invalid value for "id", id 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



400
401
402
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 400

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



406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 406

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



394
395
396
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 394

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



268
269
270
271
272
273
274
275
276
277
278
# File 'lib/hubspot/codegen/cms/domains/models/domain.rb', line 268

def valid?
  return false if @is_used_for_landing_page.nil?
  return false if @is_used_for_knowledge.nil?
  return false if @is_used_for_blog_post.nil?
  return false if @is_used_for_site_page.nil?
  return false if @is_resolving.nil?
  return false if @is_used_for_email.nil?
  return false if @domain.nil?
  return false if @id.nil?
  true
end