Class: Believe::Resources::Biscuits

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

Overview

Interactive endpoints for motivation and guidance

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Biscuits

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 Biscuits.

Parameters:



74
75
76
# File 'lib/believe/resources/biscuits.rb', line 74

def initialize(client:)
  @client = client
end

Instance Method Details

#get_fresh(request_options: {}) ⇒ ::Believe::Models::Biscuit

Get a single fresh biscuit with a personalized message from Ted.

Parameters:

Returns:

See Also:



62
63
64
65
66
67
68
69
# File 'lib/believe/resources/biscuits.rb', line 62

def get_fresh(params = {})
  @client.request(
    method: :get,
    path: "biscuits/fresh",
    model: ::Believe::Biscuit,
    options: params[:request_options]
  )
end

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

Get a paginated list of Ted’s famous homemade biscuits! Each comes with a heartwarming message.

Parameters:

  • limit (Integer)

    Maximum number of items to return (max: 100)

  • skip (Integer)

    Number of items to skip (offset)

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

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/believe/resources/biscuits.rb', line 40

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

#retrieve(biscuit_id, request_options: {}) ⇒ ::Believe::Models::Biscuit

Get a specific type of biscuit by ID.

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/believe/resources/biscuits.rb', line 17

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