Class: FrederickAPI::V2::Resource
- Inherits:
-
JsonApiClient::Resource
- Object
- JsonApiClient::Resource
- FrederickAPI::V2::Resource
show all
- Includes:
- Helpers::HasMany
- Defined in:
- lib/frederick_api/v2/resource.rb
Overview
Class from which Frederick V2 Resources inherit Inherits functionality from JsonApiClient::Resource
Direct Known Subclasses
Automation, BackgroundJob, CommunicationContent, Contact, ContactList, ContactProperty, ContactType, Interaction, Location, PublicResource, Role, User
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params = {}) ⇒ Resource
Returns a new instance of Resource.
17
18
19
20
|
# File 'lib/frederick_api/v2/resource.rb', line 17
def initialize(params = {})
self. = self.class.
super
end
|
Instance Attribute Details
Returns the value of attribute custom_headers.
15
16
17
|
# File 'lib/frederick_api/v2/resource.rb', line 15
def
@custom_headers
end
|
Class Method Details
48
49
50
|
# File 'lib/frederick_api/v2/resource.rb', line 48
def self.
Thread.current['frederick_api_header_store'] ||= {}
end
|
.all_records ⇒ Object
26
27
28
|
# File 'lib/frederick_api/v2/resource.rb', line 26
def self.all_records
self.all.pages.all_records
end
|
44
45
46
|
# File 'lib/frederick_api/v2/resource.rb', line 44
def self.
super.merge(x_api_key: top_level_namespace.config.api_key)
end
|
.site ⇒ Object
34
35
36
|
# File 'lib/frederick_api/v2/resource.rb', line 34
def self.site
"#{top_level_namespace.config.base_url}/v2/"
end
|
.top_level_namespace ⇒ Object
30
31
32
|
# File 'lib/frederick_api/v2/resource.rb', line 30
def self.top_level_namespace
@top_level_namespace ||= self.to_s.split('::').first.constantize
end
|
.with_access_token(token) ⇒ Object
38
39
40
41
42
|
# File 'lib/frederick_api/v2/resource.rb', line 38
def self.with_access_token(token)
(authorization: "Bearer #{token}") do
yield
end
end
|
Instance Method Details
#has_errors? ⇒ Boolean
22
23
24
|
# File 'lib/frederick_api/v2/resource.rb', line 22
def has_errors?
self.errors.present?
end
|