Class: Believe::Resources::Episodes

Inherits:
Object
  • Object
show all
Defined in:
lib/believe/resources/episodes.rb

Overview

Operations related to TV episodes

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Episodes

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Episodes.

Parameters:



184
185
186
# File 'lib/believe/resources/episodes.rb', line 184

def initialize(client:)
  @client = client
end

Instance Method Details

#create(air_date:, character_focus:, director:, episode_number:, main_theme:, runtime_minutes:, season:, synopsis:, ted_wisdom:, title:, writer:, biscuits_with_boss_moment: nil, memorable_moments: nil, us_viewers_millions: nil, viewer_rating: nil, request_options: {}) ⇒ ::Believe::Models::Episode

Add a new episode to the series.

Parameters:

  • air_date (Date)

    Original air date

  • character_focus (Array<String>)

    Characters with significant development

  • director (String)

    Episode director

  • episode_number (Integer)

    Episode number within season

  • main_theme (String)

    Central theme of the episode

  • runtime_minutes (Integer)

    Episode runtime in minutes

  • season (Integer)

    Season number

  • synopsis (String)

    Brief plot synopsis

  • ted_wisdom (String)

    Key piece of Ted wisdom from the episode

  • title (String)

    Episode title

  • writer (String)

    Episode writer(s)

  • biscuits_with_boss_moment (String, nil)

    Notable biscuits with the boss scene

  • memorable_moments (Array<String>)

    Standout moments from the episode

  • us_viewers_millions (Float, nil)

    US viewership in millions

  • viewer_rating (Float, nil)

    Viewer rating out of 10

  • request_options (::Believe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
# File 'lib/believe/resources/episodes.rb', line 46

def create(params)
  parsed, options = ::Believe::EpisodeCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "episodes",
    body: parsed,
    model: ::Believe::Episode,
    options: options
  )
end

#delete(episode_id, request_options: {}) ⇒ nil

Remove an episode from the database.

Parameters:

Returns:

  • (nil)

See Also:



153
154
155
156
157
158
159
160
# File 'lib/believe/resources/episodes.rb', line 153

def delete(episode_id, params = {})
  @client.request(
    method: :delete,
    path: ["episodes/%1$s", episode_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#get_wisdom(episode_id, request_options: {}) ⇒ Hash{Symbol=>Object}

Get Ted’s wisdom and memorable moments from a specific episode.

Parameters:

Returns:

  • (Hash{Symbol=>Object})

See Also:



172
173
174
175
176
177
178
179
# File 'lib/believe/resources/episodes.rb', line 172

def get_wisdom(episode_id, params = {})
  @client.request(
    method: :get,
    path: ["episodes/%1$s/wisdom", episode_id],
    model: ::Believe::Internal::Type::HashOf[::Believe::Internal::Type::Unknown],
    options: params[:request_options]
  )
end

#list(character_focus: nil, limit: nil, season: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Episode>

Get a paginated list of all Ted Lasso episodes with optional filtering by season.

Parameters:

  • character_focus (String, nil)

    Filter by character focus (character ID)

  • limit (Integer)

    Maximum number of items to return (max: 100)

  • season (Integer, nil)

    Filter by season

  • skip (Integer)

    Number of items to skip (offset)

  • request_options (::Believe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/believe/resources/episodes.rb', line 130

def list(params = {})
  parsed, options = ::Believe::EpisodeListParams.dump_request(params)
  query = ::Believe::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "episodes",
    query: query,
    page: ::Believe::Internal::SkipLimitPage,
    model: ::Believe::Episode,
    options: options
  )
end

#retrieve(episode_id, request_options: {}) ⇒ ::Believe::Models::Episode

Retrieve detailed information about a specific episode.

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
# File 'lib/believe/resources/episodes.rb', line 67

def retrieve(episode_id, params = {})
  @client.request(
    method: :get,
    path: ["episodes/%1$s", episode_id],
    model: ::Believe::Episode,
    options: params[:request_options]
  )
end

#update(episode_id, air_date: nil, biscuits_with_boss_moment: nil, character_focus: nil, director: nil, episode_number: nil, main_theme: nil, memorable_moments: nil, runtime_minutes: nil, season: nil, synopsis: nil, ted_wisdom: nil, title: nil, us_viewers_millions: nil, viewer_rating: nil, writer: nil, request_options: {}) ⇒ ::Believe::Models::Episode

Update specific fields of an existing episode.

Parameters:

  • episode_id (String)
  • air_date (Date, nil)
  • biscuits_with_boss_moment (String, nil)
  • character_focus (Array<String>, nil)
  • director (String, nil)
  • episode_number (Integer, nil)
  • main_theme (String, nil)
  • memorable_moments (Array<String>, nil)
  • runtime_minutes (Integer, nil)
  • season (Integer, nil)
  • synopsis (String, nil)
  • ted_wisdom (String, nil)
  • title (String, nil)
  • us_viewers_millions (Float, nil)
  • viewer_rating (Float, nil)
  • writer (String, nil)
  • request_options (::Believe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



101
102
103
104
105
106
107
108
109
110
# File 'lib/believe/resources/episodes.rb', line 101

def update(episode_id, params = {})
  parsed, options = ::Believe::EpisodeUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["episodes/%1$s", episode_id],
    body: parsed,
    model: ::Believe::Episode,
    options: options
  )
end