Class: Continuum::Module

Inherits:
Object
  • Object
show all
Defined in:
src/lib/continuum/module.rb

Overview

This class encapsulates all the metadata relevant to an AMP module.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_id, name, location) ⇒ Module

Returns a new instance of Module.

Parameters:

  • module_id (Integer, nil)

    The ID of the module

  • name (String, nil)

    The name of this module

  • location (String, nil)

    The location of this module



26
27
28
29
30
# File 'src/lib/continuum/module.rb', line 26

def initialize(module_id, name, location)
  @id = module_id
  @name = name
  @location = location
end

Instance Attribute Details

#idInteger

Gets the ID of this module.

Returns:

  • (Integer)

    The ID of this module in AMP; Nil if this module does not yet exist in AMP



11
12
13
# File 'src/lib/continuum/module.rb', line 11

def id
  @id
end

#locationString

Gets the location of this module.

Returns:

  • (String)

    The location of this module



21
22
23
# File 'src/lib/continuum/module.rb', line 21

def location
  @location
end

#nameString

Gets the name of this module.

Returns:

  • (String)

    The name of this module



16
17
18
# File 'src/lib/continuum/module.rb', line 16

def name
  @name
end

Instance Method Details

#get_amp_urlString?

Gets the URL to this module in AMP.

Returns:

  • (String, nil)

    The URL to this module in AMP; Nil if this module does not yet exist in AMP



35
36
37
38
# File 'src/lib/continuum/module.rb', line 35

def get_amp_url
  return nil unless @id
  URI.join(Continuum.configuration.amp_instance_url, "/public/reporting/view_module.php?module_id=#{@id}").to_s
end