Class: ElephantInTheRoom::TheOneApiSdk::ApiPaths::Base

Inherits:
Object
  • Object
show all
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

Movies

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pipelineObject (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

#listObject

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