Class: Hook0::Generated::InstanceConfigMatomo

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/models.rb

Overview

The InstanceConfigMatomo the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site_id:, url:) ⇒ InstanceConfigMatomo

Returns a new instance of InstanceConfigMatomo.

Parameters:

  • site_id (Integer)

    carries site_id.

  • url (String)

    carries url.



1413
1414
1415
1416
1417
# File 'lib/hook0/generated/models.rb', line 1413

def initialize(site_id:, url:)
  @site_id = site_id
  @url = url
  freeze
end

Instance Attribute Details

#site_idObject (readonly)

Returns the value of attribute site_id.



1408
1409
1410
# File 'lib/hook0/generated/models.rb', line 1408

def site_id
  @site_id
end

#urlObject (readonly)

Returns the value of attribute url.



1408
1409
1410
# File 'lib/hook0/generated/models.rb', line 1408

def url
  @url
end

Class Method Details

.from_json(value) ⇒ InstanceConfigMatomo

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



1423
1424
1425
1426
1427
1428
1429
# File 'lib/hook0/generated/models.rb', line 1423

def self.from_json(value)
  fields = Runtime.as_fields(value, "InstanceConfigMatomo")
  new(
    site_id: Runtime.read(fields, "site_id", Runtime::INTEGER),
    url: Runtime.read(fields, "url", Runtime::TEXT)
  )
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Whether that value carries the same members as this one.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


1445
1446
1447
# File 'lib/hook0/generated/models.rb', line 1445

def ==(other)
  other.is_a?(InstanceConfigMatomo) && to_h == other.to_h
end

#hashInteger

A value two equal instances share, so that either may key a hash.

Returns:

  • (Integer)


1453
1454
1455
# File 'lib/hook0/generated/models.rb', line 1453

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


1434
1435
1436
1437
1438
1439
# File 'lib/hook0/generated/models.rb', line 1434

def to_h
  out = {}
  out["site_id"] = @site_id
  out["url"] = @url
  out
end