Class: ElephantInTheRoom::TheOneApiSdk::ApiPaths::Base
- Inherits:
-
Object
- Object
- ElephantInTheRoom::TheOneApiSdk::ApiPaths::Base
- Includes:
- Pipeline::PipelineModifiers
- Defined in:
- lib/elephant_in_the_room/the_one_api_sdk/api_paths/base.rb
Overview
Provides common methods for all API paths
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
Instance Method Summary collapse
- #get(id) ⇒ Object
-
#initialize(pipeline) ⇒ Base
constructor
A new instance of Base.
-
#list ⇒ Object
List all items.
Methods included from Pipeline::PipelineModifiers
#replace_existing_stage, #with_filters, #with_pagination, #with_path
Constructor Details
#initialize(pipeline) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 20 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/base.rb', line 13 def initialize(pipeline) @pipeline = pipeline @pipeline = replace_existing_stage( @pipeline, :set_path, ->(next_stage) { ElephantInTheRoom::TheOneApiSdk::Pipeline::SetPath.new(next_stage, path) } ) end |
Instance Attribute Details
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
11 12 13 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/base.rb', line 11 def pipeline @pipeline end |
Instance Method Details
#get(id) ⇒ Object
28 29 30 31 32 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/base.rb', line 28 def get(id) with_path(@pipeline, id_path(id)) do |pipeline| execute_pipeline(pipeline, {}) end end |
#list ⇒ Object
List all items
24 25 26 |
# File 'lib/elephant_in_the_room/the_one_api_sdk/api_paths/base.rb', line 24 def list execute_pipeline(@pipeline, {}) end |