Class: RDStation::Segmentations

Inherits:
Object
  • Object
show all
Includes:
HTTParty, RetryableRequest
Defined in:
lib/rdstation/segmentations.rb

Constant Summary

Constants included from RetryableRequest

RetryableRequest::MAX_RETRIES

Instance Method Summary collapse

Methods included from RetryableRequest

#refresh_access_token, #retry_possible?, #retryable_request

Constructor Details

#initialize(authorization:) ⇒ Segmentations

Returns a new instance of Segmentations.



6
7
8
# File 'lib/rdstation/segmentations.rb', line 6

def initialize(authorization:)
  @authorization = authorization
end

Instance Method Details

#allObject



10
11
12
13
14
15
# File 'lib/rdstation/segmentations.rb', line 10

def all
  retryable_request(@authorization) do |authorization|
    response = self.class.get(base_url, headers: authorization.headers)
    ApiResponse.build(response)
  end
end

#contacts(segmentation_id) ⇒ Object



17
18
19
20
21
22
# File 'lib/rdstation/segmentations.rb', line 17

def contacts(segmentation_id)
  retryable_request(@authorization) do |authorization|
    response = self.class.get(base_url("#{segmentation_id}/contacts"), headers: authorization.headers)
    ApiResponse.build(response)
  end
end