Class: Refocus::Perspectives
- Inherits:
-
Object
- Object
- Refocus::Perspectives
- Includes:
- JsonHelper
- Defined in:
- lib/refocus/perspectives.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #all ⇒ Object
- #create(name:, lens:, root_subject:) ⇒ Object
- #get(name:) ⇒ Object
-
#initialize(url:, token:) ⇒ Perspectives
constructor
A new instance of Perspectives.
Methods included from JsonHelper
Constructor Details
#initialize(url:, token:) ⇒ Perspectives
Returns a new instance of Perspectives.
9 10 11 |
# File 'lib/refocus/perspectives.rb', line 9 def initialize(url:, token:) @http = Refocus::Http.new(url: url, token: token) end |
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
7 8 9 |
# File 'lib/refocus/perspectives.rb', line 7 def http @http end |
Instance Method Details
#all ⇒ Object
13 14 15 |
# File 'lib/refocus/perspectives.rb', line 13 def all json(http.get("")) end |
#create(name:, lens:, root_subject:) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/refocus/perspectives.rb', line 21 def create(name:, lens:, root_subject:) body = { "name" => name, "lensId" => lens, "rootSubject" => root_subject } json(http.post("", body: body)) end |
#get(name:) ⇒ Object
17 18 19 |
# File 'lib/refocus/perspectives.rb', line 17 def get(name:) json(http.get(name)) end |