Sha256: b26bf4706041db1b35d6e510d86617b52b887be060aa3bff5e3a238bd5789bba

Contents?: true

Size: 513 Bytes

Versions: 5

Compression:

Stored size: 513 Bytes

Contents

module Loquor
  class ApiCall::Show < ApiCall

    def initialize(klass, id)
      super(klass)
      @id = id
    end

    def execute
      return nil unless @id
      begin
        get_data
      rescue RestClient::ResourceNotFound
        if Loquor.config.retry_404s
          sleep(1)
          get_data
        else
          raise
        end
      end
    end

    private
    def get_data
      options = {cache: klass.cache}
      klass.new Loquor.get("#{klass.path}/#{@id}", options)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loquor-1.13.0 lib/loquor/api_calls/show.rb
loquor-1.12.0 lib/loquor/api_calls/show.rb
loquor-1.11.0 lib/loquor/api_calls/show.rb
loquor-1.10.0 lib/loquor/api_calls/show.rb
loquor-1.9.0 lib/loquor/api_calls/show.rb