Sha256: 9c679b87c2f03cb95228862ea0a10feca9a0ac45b1b6c635266d4de751975192

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

# encoding: utf-8
module RDStation
  # More info: https://developers.rdstation.com/pt-BR/reference/contacts
  class Fields
    include HTTParty

    BASE_URL = 'https://api.rd.services/platform/contacts/fields'.freeze

    def initialize(auth_token)
      @auth_token = auth_token
    end

    def all
      response = self.class.get(BASE_URL, headers: required_headers)
      response_body = JSON.parse(response.body)
      return response_body unless response_body['errors']
      RDStation::ErrorHandler.new(response).raise_errors
    end

    private

    def required_headers
      { "Authorization" => "Bearer #{@auth_token}", "Content-Type" => "application/json" }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rdstation-ruby-client-1.1.0 lib/rdstation/fields.rb
rdstation-ruby-client-1.0.1 lib/rdstation/fields.rb
rdstation-ruby-client-1.0.0 lib/rdstation/fields.rb