Sha256: 2e4f664024a2a9411bf09e38b42d106686e2a926e9d26a6a1d5af2fcbd1b0ee5

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

# Base class for authorized resources sending network requests
class Airtable::Resource
  include HTTParty
  base_uri 'https://api.airtable.com'
  # debug_output $stdout

  attr_reader :id, :token

  def initialize(token)
    @token = token
    self.class.headers({ 'Authorization': "Bearer #{@token}", 'Content-Type': 'application/json' })
  end

  def check_and_raise_error(response)
    response['error'] ? raise(Error, response['error']) : false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
airtable2-0.2.0 lib/airtable/resource.rb