Class: Myfdb::Batch

Inherits:
Object
  • Object
show all
Includes:
Batch::Images
Defined in:
lib/myfdb/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Batch::Images

#images, #images?, included, #process_images

Constructor Details

#initialize(directory, uri) ⇒ Batch

Returns a new instance of Batch.



9
10
11
12
13
# File 'lib/myfdb/batch.rb', line 9

def initialize(directory, uri)
  @directory = directory
  @errors = []
  @uri = uri
end

Instance Attribute Details

#directoryObject (readonly)

Returns the value of attribute directory.



7
8
9
# File 'lib/myfdb/batch.rb', line 7

def directory
  @directory
end

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/myfdb/batch.rb', line 7

def errors
  @errors
end

#uriObject (readonly)

Returns the value of attribute uri.



7
8
9
# File 'lib/myfdb/batch.rb', line 7

def uri
  @uri
end

Instance Method Details

#idObject



19
20
21
22
23
24
# File 'lib/myfdb/batch.rb', line 19

def id
  @id ||= File.read(File.join directory, 'issue_id')
rescue Errno::ENOENT
  response = create_issue
  response.is_a?(Integer) ? @id = response : errors << response 
end

#store!Object



15
16
17
# File 'lib/myfdb/batch.rb', line 15

def store!
  id && process_images if images?
end