Class: DatagroutConduit::PrismNamespace
- Inherits:
-
Object
- Object
- DatagroutConduit::PrismNamespace
- Defined in:
- lib/datagrout_conduit/namespaces/prism.rb
Instance Method Summary collapse
- #chart(goal:, payload:, **opts) ⇒ Object
- #export(content:, format:, style: nil, metadata: nil, **opts) ⇒ Object
- #focus(data:, source_type:, target_type:, source_annotations: nil, target_annotations: nil, context: nil) ⇒ Object
-
#initialize(client) ⇒ PrismNamespace
constructor
A new instance of PrismNamespace.
- #refract(goal:, payload:, **opts) ⇒ Object
- #render(goal:, payload: nil, format: "markdown", sections: nil, **opts) ⇒ Object
Constructor Details
#initialize(client) ⇒ PrismNamespace
Returns a new instance of PrismNamespace.
5 6 7 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#chart(goal:, payload:, **opts) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 16 def chart(goal:, payload:, **opts) params = { "goal" => goal, "payload" => payload } params["format"] = opts[:format] if opts[:format] params["chart_type"] = opts[:chart_type] if opts[:chart_type] params["title"] = opts[:title] if opts[:title] params["x_label"] = opts[:x_label] if opts[:x_label] params["y_label"] = opts[:y_label] if opts[:y_label] params["width"] = opts[:width] if opts[:width] params["height"] = opts[:height] if opts[:height] dg_call("prism.chart", params) end |
#export(content:, format:, style: nil, metadata: nil, **opts) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 35 def export(content:, format:, style: nil, metadata: nil, **opts) params = { "content" => content, "format" => format }.merge(@client.send(:normalize_hash, opts)) params["style"] = style if style params["metadata"] = if dg_call("prism.export", params) end |
#focus(data:, source_type:, target_type:, source_annotations: nil, target_annotations: nil, context: nil) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 42 def focus(data:, source_type:, target_type:, source_annotations: nil, target_annotations: nil, context: nil) params = { "data" => data, "source_type" => source_type, "target_type" => target_type } params["source_annotations"] = source_annotations if source_annotations params["target_annotations"] = target_annotations if target_annotations params["context"] = context if context dg_call("prism.focus", params) end |
#refract(goal:, payload:, **opts) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 9 def refract(goal:, payload:, **opts) params = { "goal" => goal, "payload" => payload } params["verbose"] = opts[:verbose] if opts.key?(:verbose) params["chart"] = opts[:chart] if opts.key?(:chart) dg_call("prism.refract", params) end |
#render(goal:, payload: nil, format: "markdown", sections: nil, **opts) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/datagrout_conduit/namespaces/prism.rb', line 28 def render(goal:, payload: nil, format: "markdown", sections: nil, **opts) params = { "goal" => goal, "format" => format }.merge(@client.send(:normalize_hash, opts)) params["payload"] = payload if payload params["sections"] = sections if sections dg_call("prism.render", params) end |