Method: Contentstack::SyncResult#initialize

Defined in:
lib/contentstack/sync_result.rb

#initialize(sync_result) ⇒ SyncResult

Returns a new instance of SyncResult.

[View source]

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/contentstack/sync_result.rb', line 12

def initialize(sync_result)
  if sync_result.nil?
    @items = []
    @sync_token = nil
    @pagination_token = nil
    @total_count = 0
    @skip = 0
    @limit = 100
  else
    @items = sync_result["items"] || []
    @sync_token = sync_result["sync_token"] || nil
    @pagination_token = sync_result["pagination_token"] || nil
    @total_count = sync_result["total_count"] || 0
    @skip = sync_result["skip"] || 0
    @limit = sync_result["limit"] || 100
  end
end