Class: Cts::Mpx::Driver::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/cts/mpx/service.rb

Overview

Class to wrap a service and what is available to interact with

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeService

Set all values to something



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cts/mpx/service.rb', line 35

def initialize
  @name = ""
  @uri_hint = ""
  @path = ""
  @form = ""
  @schema = ""
  @search_schema = ""
  @read_only = false
  @endpoints = []
  @type = nil
  @url = nil
end

Instance Attribute Details

#endpointsArray

Returns Available endpoints to communicate with.

Returns:

  • (Array)

    Available endpoints to communicate with



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#formString

Returns type of http schema to use, can be json or cjson.

Returns:

  • (String)

    type of http schema to use, can be json or cjson



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#nameString

Returns Title of the service, must be identical to the registry entry.

Returns:

  • (String)

    Title of the service, must be identical to the registry entry



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#pathString

Returns prepended path statement attached per service.

Returns:

  • (String)

    prepended path statement attached per service



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#read_onlyBoolean

Returns is this a read only service or not.

Returns:

  • (Boolean)

    is this a read only service or not



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#schemaString

Returns version of the service schema.

Returns:

  • (String)

    version of the service schema



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#search_schemaString

Returns version of the search schema.

Returns:

  • (String)

    version of the search schema



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#typeString

Returns the type of service this is.

Returns:

  • (String)

    the type of service this is



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

#uri_hintString

Returns partial string of the uri, this allows for a reverse lookup from url.

Returns:

  • (String)

    partial string of the uri, this allows for a reverse lookup from url



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cts/mpx/service.rb', line 23

class Service
  attr_accessor :name
  attr_accessor :uri_hint
  attr_accessor :path
  attr_accessor :form
  attr_accessor :schema
  attr_accessor :search_schema
  attr_accessor :read_only
  attr_accessor :endpoints
  attr_accessor :type

  # Set all values to something
  def initialize
    @name = ""
    @uri_hint = ""
    @path = ""
    @form = ""
    @schema = ""
    @search_schema = ""
    @read_only = false
    @endpoints = []
    @type = nil
    @url = nil
  end

  # Return a given url of a service, will look in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [String] the url string or nil if none available
  def url( = 'urn:theplatform:auth:root')
     ||= 'urn:theplatform:auth:root'
    Exceptions. 
    reg = Registry.domains[]
    return reg[name] if reg

    nil
  end

  # checks if we have a given entry in the local registry
  # @param [String] account_id long form account id (ownerId)
  # @return [Boolean] true if it is available, false if it is not
  def url?( = 'urn:theplatform:auth:root')
    Exceptions. 
    u = url 
    return true if u

    false
  end
end

Instance Method Details

#url(account_id = 'urn:theplatform:auth:root') ⇒ String

Return a given url of a service, will look in the local registry

Parameters:

  • account_id (String) (defaults to: 'urn:theplatform:auth:root')

    long form account id (ownerId)

Returns:

  • (String)

    the url string or nil if none available



51
52
53
54
55
56
57
58
# File 'lib/cts/mpx/service.rb', line 51

def url( = 'urn:theplatform:auth:root')
   ||= 'urn:theplatform:auth:root'
  Exceptions. 
  reg = Registry.domains[]
  return reg[name] if reg

  nil
end

#url?(account_id = 'urn:theplatform:auth:root') ⇒ Boolean

checks if we have a given entry in the local registry

Parameters:

  • account_id (String) (defaults to: 'urn:theplatform:auth:root')

    long form account id (ownerId)

Returns:

  • (Boolean)

    true if it is available, false if it is not



63
64
65
66
67
68
69
# File 'lib/cts/mpx/service.rb', line 63

def url?( = 'urn:theplatform:auth:root')
  Exceptions. 
  u = url 
  return true if u

  false
end