Class: VORuby::Plastic::Application::Base
- Defined in:
- lib/voruby/plastic/applications.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#hub_id ⇒ Object
readonly
Returns the value of attribute hub_id.
-
#icon_url ⇒ Object
readonly
Returns the value of attribute icon_url.
-
#ivorn ⇒ Object
readonly
Returns the value of attribute ivorn.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plastic_version ⇒ Object
readonly
Returns the value of attribute plastic_version.
Instance Method Summary collapse
- #get_message_registered_ids(msg) ⇒ Object
- #get_name(app_id) ⇒ Object
- #get_registered_ids ⇒ Object
- #get_understood_messages(app_id) ⇒ Object
-
#initialize(name = nil, description = nil, icon_url = nil, ivorn = nil, plastic_version = 0.5) ⇒ Base
constructor
A new instance of Base.
- #register ⇒ Object
- #request(msg, *args) ⇒ Object
- #request_asynch(msg, *args) ⇒ Object
- #request_to_subset(msg, args, *recipients) ⇒ Object
- #request_to_subset_asynch(msg, args, recipients) ⇒ Object
- #unregister ⇒ Object
Constructor Details
#initialize(name = nil, description = nil, icon_url = nil, ivorn = nil, plastic_version = 0.5) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/voruby/plastic/applications.rb', line 10 def initialize(name=nil, description=nil, icon_url=nil, ivorn=nil, plastic_version=0.5) initialize_config() @hub = ::XMLRPC::Client.new_from_uri(@config['plastic.xmlrpc.url']) @name = name @hub_id = URI.parse(call('plastic.hub.getHubId')) @description = description @icon_url = icon_url @ivorn = ivorn @plastic_version = plastic_version end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def app_id @app_id end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def config @config end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def description @description end |
#hub_id ⇒ Object (readonly)
Returns the value of attribute hub_id.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def hub_id @hub_id end |
#icon_url ⇒ Object (readonly)
Returns the value of attribute icon_url.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def icon_url @icon_url end |
#ivorn ⇒ Object (readonly)
Returns the value of attribute ivorn.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def ivorn @ivorn end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def name @name end |
#plastic_version ⇒ Object (readonly)
Returns the value of attribute plastic_version.
8 9 10 |
# File 'lib/voruby/plastic/applications.rb', line 8 def plastic_version @plastic_version end |
Instance Method Details
#get_message_registered_ids(msg) ⇒ Object
47 48 49 |
# File 'lib/voruby/plastic/applications.rb', line 47 def (msg) call('plastic.hub.getMessageRegisteredIds', msg.to_s).collect{ |uri| URI.parse(uri) } end |
#get_name(app_id) ⇒ Object
51 52 53 54 |
# File 'lib/voruby/plastic/applications.rb', line 51 def get_name(app_id) name = call('plastic.hub.getName', app_id.to_s) (name != '')? name: nil end |
#get_registered_ids ⇒ Object
39 40 41 |
# File 'lib/voruby/plastic/applications.rb', line 39 def get_registered_ids call('plastic.hub.getRegisteredIds').collect{ |uri| URI.parse(uri) } end |
#get_understood_messages(app_id) ⇒ Object
43 44 45 |
# File 'lib/voruby/plastic/applications.rb', line 43 def (app_id) call('plastic.hub.getUnderstoodMessages', app_id.to_s).collect{ |uri| URI.parse(uri) } end |
#register ⇒ Object
35 36 37 |
# File 'lib/voruby/plastic/applications.rb', line 35 def register @app_id = call('plastic.hub.registerNoCallBack', self.name) end |
#request(msg, *args) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/voruby/plastic/applications.rb', line 60 def request(msg, *args) responses = {} call('plastic.hub.request', self.app_id.to_s, msg.to_s, args).each do |app_id, response| responses[URI.parse(app_id)] = response end responses end |
#request_asynch(msg, *args) ⇒ Object
79 80 81 |
# File 'lib/voruby/plastic/applications.rb', line 79 def request_asynch(msg, *args) call_async('plastic.hub.requestAsynch', self.app_id.to_s, msg.to_s, args) end |
#request_to_subset(msg, args, *recipients) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/voruby/plastic/applications.rb', line 69 def request_to_subset(msg, args, *recipients) responses = {} call('plastic.hub.requestToSubset', self.app_id.to_s, msg.to_s, args, recipients.collect{ |id| id.to_s }).each do |app_id, response| responses[URI.parse(app_id)] = response end responses end |
#request_to_subset_asynch(msg, args, recipients) ⇒ Object
83 84 85 |
# File 'lib/voruby/plastic/applications.rb', line 83 def request_to_subset_asynch(msg, args, recipients) call_async('plastic.hub.requestToSubsetAsynch', self.app_id.to_s, msg.to_s, args, recipients.collect{ |id| id.to_s }) end |
#unregister ⇒ Object
56 57 58 |
# File 'lib/voruby/plastic/applications.rb', line 56 def unregister call('plastic.hub.unregister', self.app_id.to_s) if self.app_id end |