Class: Alfresco4r::AbstractAlfrescoService
- Inherits:
-
Object
- Object
- Alfresco4r::AbstractAlfrescoService
show all
- Defined in:
- lib/alfresco4r/abstract_service.rb
Constant Summary
collapse
- BOUNDARY =
"AaB03x"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractAlfrescoService.
10
11
12
13
14
15
16
17
|
# File 'lib/alfresco4r/abstract_service.rb', line 10
def initialize(options)
@options = options
self_class = self.class.name
klass_url = self_class.concat("Url")
@auth_obj = DocumentAuth.new(options)
@url_obj = klass_url == "Alfresco4r::DocumentDownloadUrl" ? DocumentDownloadUrl.new(options) : DocumentUploadUrl.new(options)
self_class.include?('Upload') ? post_object : get_object
end
|
Instance Attribute Details
#http ⇒ Object
Returns the value of attribute http.
8
9
10
|
# File 'lib/alfresco4r/abstract_service.rb', line 8
def http
@http
end
|
#options ⇒ Object
Returns the value of attribute options.
8
9
10
|
# File 'lib/alfresco4r/abstract_service.rb', line 8
def options
@options
end
|
#request ⇒ Object
Returns the value of attribute request.
8
9
10
|
# File 'lib/alfresco4r/abstract_service.rb', line 8
def request
@request
end
|
#uri ⇒ Object
Returns the value of attribute uri.
8
9
10
|
# File 'lib/alfresco4r/abstract_service.rb', line 8
def uri
@uri
end
|
Instance Method Details
#containerid ⇒ Object
37
38
39
|
# File 'lib/alfresco4r/abstract_service.rb', line 37
def containerid
@containerid = options[:containerid]
end
|
#filedata ⇒ Object
45
46
47
|
# File 'lib/alfresco4r/abstract_service.rb', line 45
def filedata
@filedata = options[:filedata]
end
|
#full_file_name ⇒ Object
53
54
55
|
# File 'lib/alfresco4r/abstract_service.rb', line 53
def full_file_name
@full_file_name = options[:full_file_name]
end
|
#get_object ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/alfresco4r/abstract_service.rb', line 25
def get_object
@uri = URI(@url_obj.url(node))
@uri.query = URI.encode_www_form( { :a => 'true' } )
@http = Net::HTTP.new(@uri.host, @uri.port)
@request = Net::HTTP::Get.new(@uri.request_uri)
@request.basic_auth @auth_obj.username, @auth_obj.password
end
|
#mime_type ⇒ Object
49
50
51
|
# File 'lib/alfresco4r/abstract_service.rb', line 49
def mime_type
@mime_type = options[:mime_type]
end
|
#node ⇒ Object
57
58
59
|
# File 'lib/alfresco4r/abstract_service.rb', line 57
def node
@node = options[:node]
end
|
#post_object ⇒ Object
19
20
21
22
23
|
# File 'lib/alfresco4r/abstract_service.rb', line 19
def post_object
@uri = URI(@url_obj.url)
@request = Net::HTTP::Post.new(@uri.path)
@request.basic_auth @auth_obj.username, @auth_obj.password
end
|
#siteid ⇒ Object
33
34
35
|
# File 'lib/alfresco4r/abstract_service.rb', line 33
def siteid
@siteid = options[:siteid]
end
|
#uploaddirectory ⇒ Object
41
42
43
|
# File 'lib/alfresco4r/abstract_service.rb', line 41
def uploaddirectory
@uploaddirectory = options[:uploaddirectory]
end
|