Class: Cts::Mpx::Driver::Service
- Inherits:
-
Object
- Object
- Cts::Mpx::Driver::Service
- Defined in:
- lib/cts/mpx/service.rb
Overview
Class to wrap a service and what is available to interact with
Instance Attribute Summary collapse
-
#endpoints ⇒ Array
Available endpoints to communicate with.
-
#form ⇒ String
Type of http schema to use, can be json or cjson.
-
#name ⇒ String
Title of the service, must be identical to the registry entry.
-
#path ⇒ String
Prepended path statement attached per service.
-
#read_only ⇒ Boolean
Is this a read only service or not.
-
#schema ⇒ String
Version of the service schema.
-
#search_schema ⇒ String
Version of the search schema.
-
#type ⇒ String
The type of service this is.
-
#uri_hint ⇒ String
Partial string of the uri, this allows for a reverse lookup from url.
Instance Method Summary collapse
-
#initialize ⇒ Service
constructor
Set all values to something.
-
#url(account_id = 'urn:theplatform:auth:root') ⇒ String
Return a given url of a service, will look in the local registry.
-
#url?(account_id = 'urn:theplatform:auth:root') ⇒ Boolean
checks if we have a given entry in the local registry.
Constructor Details
#initialize ⇒ Service
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
#endpoints ⇒ Array
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#form ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#name ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#path ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#read_only ⇒ Boolean
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#schema ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#search_schema ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#type ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end end |
#uri_hint ⇒ String
Returns 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(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id 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
51 52 53 54 55 56 57 58 |
# File 'lib/cts/mpx/service.rb', line 51 def url(account_id = 'urn:theplatform:auth:root') account_id ||= 'urn:theplatform:auth:root' Exceptions.raise_unless_account_id account_id reg = Registry.domains[account_id] 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
63 64 65 66 67 68 69 |
# File 'lib/cts/mpx/service.rb', line 63 def url?(account_id = 'urn:theplatform:auth:root') Exceptions.raise_unless_account_id account_id u = url account_id return true if u false end |