Class: Refocus::Perspectives

Inherits:
Object
  • Object
show all
Includes:
JsonHelper
Defined in:
lib/refocus/perspectives.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JsonHelper

#json

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

#httpObject (readonly)

Returns the value of attribute http.



7
8
9
# File 'lib/refocus/perspectives.rb', line 7

def http
  @http
end

Instance Method Details

#allObject



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