Class: Believe::Resources::Quotes
- Inherits:
-
Object
- Object
- Believe::Resources::Quotes
- Defined in:
- lib/believe/resources/quotes.rb
Overview
Memorable quotes from the show
Instance Method Summary collapse
-
#create(character_id:, context:, moment_type:, text:, theme:, episode_id: nil, is_funny: nil, is_inspirational: nil, popularity_score: nil, secondary_themes: nil, times_shared: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Add a new memorable quote to the collection.
-
#delete(quote_id, request_options: {}) ⇒ nil
Remove a quote from the collection.
-
#get_random(character_id: nil, inspirational: nil, theme: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Get a random Ted Lasso quote, optionally filtered.
-
#initialize(client:) ⇒ Quotes
constructor
private
A new instance of Quotes.
-
#list(character_id: nil, funny: nil, inspirational: nil, limit: nil, moment_type: nil, skip: nil, theme: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of all memorable Ted Lasso quotes with optional filtering.
-
#list_by_character(character_id, limit: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of quotes from a specific character.
-
#list_by_theme(theme, limit: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of quotes related to a specific theme.
-
#retrieve(quote_id, request_options: {}) ⇒ ::Believe::Models::Quote
Retrieve a specific quote by its ID.
-
#update(quote_id, character_id: nil, context: nil, episode_id: nil, is_funny: nil, is_inspirational: nil, moment_type: nil, popularity_score: nil, secondary_themes: nil, text: nil, theme: nil, times_shared: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Update specific fields of an existing quote.
Constructor Details
#initialize(client:) ⇒ Quotes
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 Quotes.
253 254 255 |
# File 'lib/believe/resources/quotes.rb', line 253 def initialize(client:) @client = client end |
Instance Method Details
#create(character_id:, context:, moment_type:, text:, theme:, episode_id: nil, is_funny: nil, is_inspirational: nil, popularity_score: nil, secondary_themes: nil, times_shared: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Add a new memorable quote to the collection.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/believe/resources/quotes.rb', line 38 def create(params) parsed, = ::Believe::QuoteCreateParams.dump_request(params) @client.request( method: :post, path: "quotes", body: parsed, model: ::Believe::Quote, options: ) end |
#delete(quote_id, request_options: {}) ⇒ nil
Remove a quote from the collection.
158 159 160 161 162 163 164 165 |
# File 'lib/believe/resources/quotes.rb', line 158 def delete(quote_id, params = {}) @client.request( method: :delete, path: ["quotes/%1$s", quote_id], model: NilClass, options: params[:request_options] ) end |
#get_random(character_id: nil, inspirational: nil, theme: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Get a random Ted Lasso quote, optionally filtered.
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/believe/resources/quotes.rb', line 182 def get_random(params = {}) parsed, = ::Believe::QuoteGetRandomParams.dump_request(params) query = ::Believe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "quotes/random", query: query, model: ::Believe::Quote, options: ) end |
#list(character_id: nil, funny: nil, inspirational: nil, limit: nil, moment_type: nil, skip: nil, theme: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of all memorable Ted Lasso quotes with optional filtering.
135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/believe/resources/quotes.rb', line 135 def list(params = {}) parsed, = ::Believe::QuoteListParams.dump_request(params) query = ::Believe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "quotes", query: query, page: ::Believe::Internal::SkipLimitPage, model: ::Believe::Quote, options: ) end |
#list_by_character(character_id, limit: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of quotes from a specific character.
209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/believe/resources/quotes.rb', line 209 def list_by_character(character_id, params = {}) parsed, = ::Believe::QuoteListByCharacterParams.dump_request(params) query = ::Believe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["quotes/characters/%1$s", character_id], query: query, page: ::Believe::Internal::SkipLimitPage, model: ::Believe::Quote, options: ) end |
#list_by_theme(theme, limit: nil, skip: nil, request_options: {}) ⇒ ::Believe::Internal::SkipLimitPage<::Believe::Models::Quote>
Get a paginated list of quotes related to a specific theme.
237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/believe/resources/quotes.rb', line 237 def list_by_theme(theme, params = {}) parsed, = ::Believe::QuoteListByThemeParams.dump_request(params) query = ::Believe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["quotes/themes/%1$s", theme], query: query, page: ::Believe::Internal::SkipLimitPage, model: ::Believe::Quote, options: ) end |
#retrieve(quote_id, request_options: {}) ⇒ ::Believe::Models::Quote
Retrieve a specific quote by its ID.
59 60 61 62 63 64 65 66 |
# File 'lib/believe/resources/quotes.rb', line 59 def retrieve(quote_id, params = {}) @client.request( method: :get, path: ["quotes/%1$s", quote_id], model: ::Believe::Quote, options: params[:request_options] ) end |
#update(quote_id, character_id: nil, context: nil, episode_id: nil, is_funny: nil, is_inspirational: nil, moment_type: nil, popularity_score: nil, secondary_themes: nil, text: nil, theme: nil, times_shared: nil, request_options: {}) ⇒ ::Believe::Models::Quote
Update specific fields of an existing quote.
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/believe/resources/quotes.rb', line 101 def update(quote_id, params = {}) parsed, = ::Believe::QuoteUpdateParams.dump_request(params) @client.request( method: :patch, path: ["quotes/%1$s", quote_id], body: parsed, model: ::Believe::Quote, options: ) end |