Class: Envoi::Aspera::WatchService::WatchFolder::Subscription::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/envoi/aspera/watch_service/watch_folder.rb

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subscription, version) ⇒ Snapshot

Returns a new instance of Snapshot.



61
62
63
64
65
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 61

def initialize(subscription, version)
  @subscription = subscription
  @version      = version
  @entries      = nil
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



59
60
61
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 59

def entries
  @entries
end

#subscriptionObject

Returns the value of attribute subscription.



59
60
61
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 59

def subscription
  @subscription
end

#versionObject

Returns the value of attribute version.



59
60
61
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 59

def version
  @version
end

Instance Method Details

#clientObject



67
68
69
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 67

def client
  subscription.client
end

#differential(from = nil) ⇒ Object



80
81
82
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 80

def differential(from = nil)
  (@differentials ||= {})[from] ||= differential_no_cache(from: from)
end

#differential_no_cache(args = {}) ⇒ Object



84
85
86
87
88
89
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 84

def differential_no_cache(args = {})
  args_out                   = args.dup
  args_out[:subscription_id] ||= subscription['identifier']
  args_out[:to]              ||= version
  client.subscription_snapshot_differential(args_out)
end

#entries_by_pathObject



91
92
93
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 91

def entries_by_path
  @entries_by_hash ||= Hash[entries.map { |e| [e[:path], e] }]
end

#loggerObject



71
72
73
# File 'lib/envoi/aspera/watch_service/watch_folder.rb', line 71

def logger
  client.logger
end