Sha256: d19380bb02053b70c8548574cf817cf899b66fbcf81cd2bde76a5ded7608eecb

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

require_relative "base"
require_relative "quote"
require_relative "paginator"

module Theone
  # Movie API def
  class Movie < Base
    BASE_PATH = "/movie"

    class << self
      def all(client)
        Paginator.paginate(client, BASE_PATH) { |movie_json| Movie.new(client, movie_json) }
      end

      def one(client, id)
        movie_json = client.api_request("#{BASE_PATH}/#{id}").first
        Movie.new(client, movie_json)
      end
    end

    def quotes
      Paginator.paginate(client, "#{BASE_PATH}/#{id}/quote") { |quote_json| Quote.new(client, quote_json) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
juggy-theone-sdk-0.1.1 lib/theone/movie.rb
juggy-theone-sdk-0.1.0 lib/theone/movie.rb