Class: Posthubify::QueueResource

Inherits:
Object
  • Object
show all
Defined in:
lib/posthubify/resources/platform.rb

Overview

Publishing queue (Node sdk .queue). Sub-resource: schedules.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ QueueResource

Returns a new instance of QueueResource.



99
100
101
102
# File 'lib/posthubify/resources/platform.rb', line 99

def initialize(http)
  @http = http
  @schedules = QueueSchedulesResource.new(http)
end

Instance Attribute Details

#schedulesObject (readonly)

Returns the value of attribute schedules.



97
98
99
# File 'lib/posthubify/resources/platform.rb', line 97

def schedules
  @schedules
end

Instance Method Details

#next_slot(profile_id: nil) ⇒ Object

The next EMPTY slot — posts.create(queue: true) lands here.



105
106
107
# File 'lib/posthubify/resources/platform.rb', line 105

def next_slot(profile_id: nil)
  @http.data('GET', '/queue/next-slot', query: { 'profileId' => profile_id })
end

#preview(profile_id: nil, count: nil) ⇒ Object

Preview of upcoming slots (with taken flag).



110
111
112
# File 'lib/posthubify/resources/platform.rb', line 110

def preview(profile_id: nil, count: nil)
  @http.data('GET', '/queue/preview', query: { 'profileId' => profile_id, 'count' => count })
end