Class: OpenKit::Request::Upload

Inherits:
Object
  • Object
show all
Defined in:
lib/openkit/request/upload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param_name, filepath) ⇒ Upload

Returns a new instance of Upload.



7
8
9
10
# File 'lib/openkit/request/upload.rb', line 7

def initialize(param_name, filepath)
  @param_name = param_name
  @filepath = filepath
end

Instance Attribute Details

#filepathObject

Returns the value of attribute filepath.



5
6
7
# File 'lib/openkit/request/upload.rb', line 5

def filepath
  @filepath
end

#param_nameObject

Returns the value of attribute param_name.



5
6
7
# File 'lib/openkit/request/upload.rb', line 5

def param_name
  @param_name
end

Instance Method Details

#closeObject



16
17
18
# File 'lib/openkit/request/upload.rb', line 16

def close
  @file.close if @file  # Use ivar directly, not the #file method.
end

#fileObject



12
13
14
# File 'lib/openkit/request/upload.rb', line 12

def file
  @file ||= File.open(@filepath)
end