Class: Refocus::Aspects
- Inherits:
-
Object
- Object
- Refocus::Aspects
- Includes:
- JsonHelper, PathHelper
- Defined in:
- lib/refocus/aspects.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
- #all ⇒ Object
- #create(name:, options: {}) ⇒ Object
- #default_options ⇒ Object
- #delete(name:) ⇒ Object
- #get(name:) ⇒ Object
-
#initialize(url:, token:) ⇒ Aspects
constructor
A new instance of Aspects.
- #update(name:, options: {}) ⇒ Object
Methods included from PathHelper
Methods included from JsonHelper
Constructor Details
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
10 11 12 |
# File 'lib/refocus/aspects.rb', line 10 def http @http end |
Instance Method Details
#all ⇒ Object
16 17 18 |
# File 'lib/refocus/aspects.rb', line 16 def all json(http.get("")) end |
#create(name:, options: {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/refocus/aspects.rb', line 20 def create(name:, options: {} ) parent, child = parent_and_name(name) path = parent ? "#{parent}/child" : "" body = .merge("name" => child).merge() json(http.post(path, body: body)) end |
#default_options ⇒ Object
39 40 41 42 43 |
# File 'lib/refocus/aspects.rb', line 39 def { "timeout" => "5m" } end |
#delete(name:) ⇒ Object
31 32 33 |
# File 'lib/refocus/aspects.rb', line 31 def delete(name:) json(http.delete(name)) end |
#get(name:) ⇒ Object
35 36 37 |
# File 'lib/refocus/aspects.rb', line 35 def get(name:) json(http.get(name)) end |
#update(name:, options: {}) ⇒ Object
27 28 29 |
# File 'lib/refocus/aspects.rb', line 27 def update(name:, options: {} ) http.patch(name, body: ) end |