Class: RDStation::Fields

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/rdstation/fields.rb

Overview

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(auth_token) ⇒ Fields

Returns a new instance of Fields.



9
10
11
# File 'lib/rdstation/fields.rb', line 9

def initialize(auth_token)
  @auth_token = auth_token
end

Instance Method Details

#all ⇒ Object



13
14
15
16
17
18
# File 'lib/rdstation/fields.rb', line 13

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