Class: Interfacets::Client::Channels::Api::Builder
- Inherits:
-
Object
- Object
- Interfacets::Client::Channels::Api::Builder
- Defined in:
- lib/interfacets/client/channels/api.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
Instance Attribute Details
#entity ⇒ Object
Returns the value of attribute entity.
10 11 12 |
# File 'lib/interfacets/client/channels/api.rb', line 10 def entity @entity end |
#request ⇒ Object
Returns the value of attribute request.
10 11 12 |
# File 'lib/interfacets/client/channels/api.rb', line 10 def request @request end |
Instance Method Details
#render(path) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/interfacets/client/channels/api.rb', line 12 def render(path) raise("only one submission per action") if request System.logger.debug("Getting #{path}") request_id = SecureRandom.uuid self.request = { url: Client::System.current_bus.url_for(path), method: "get", } end |
#submit(meth, nesting:) ⇒ Object
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 |
# File 'lib/interfacets/client/channels/api.rb', line 25 def submit(meth, nesting: ) raise("only one submission per action") if request System.logger.debug("submitting #{meth}") request_id = SecureRandom.uuid self.request = { url: ( if entity.respond_to?(:api_path) Client::System.current_bus.url_for(entity.api_path) end ), method: "put", body: { event: { id: request_id, type: "interfacets:api:submit", payload: ( Shared::Entities::Bus .new(entity:) .serialize( to: "server" , action: meth, nesting: ) ) }, }, } end |