yaccl 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDMxM2Q1NjAyYzIyZGUxYTgxMmYxOWU4OGNlNjRjNTg0NmZjNmEzMA==
4
+ NWI2YmU0MjQ1N2Y3ZjEzMzc1MzU2ZmYxMmE2NmYxMjM4NTFjM2ExYg==
5
5
  data.tar.gz: !binary |-
6
- M2FiNTMxMDMwMTMyYzhiYjk5MzkzNmNmYjIyOTZhYjMyMWI0NDMyMw==
6
+ OWEzZTlkMzcyYWVmYTBkYjM5NzEyNTdhNThhMzFiYjU2NmNjNTcwOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDJkYTE0OTFjYmY2MzUwMzAwYjA0OWE5YzEyNjBlYWY3OWRjN2MyZjEwMWVj
10
- NDkzOWM1ZDJiN2YyYzFkZDcyOTdjNzI4YWY5OWVhZGIzOWNhOTRmZjQ4NDIz
11
- ZmMzNWEwODFlM2JkNDgxZmU3NmNlNzZlZjJmY2RjYzY2N2I2OTE=
9
+ NDM5M2U4NDIxNjZjZmIwNTNjMmE3ZGJlZTFmMWIzZTRjMzQyMWNhNDhkMjUy
10
+ MGQ4NzY3MmVlZGQwYzk4MzUzZWUwOTYwNTZjYjBkZTFkOGNmOWI0ZjI2ZWFl
11
+ ODg3OGQwOTE4NDMyMWU2OTBiZjdhZjE4ZGQwOTdmYmVmMGQ3MGM=
12
12
  data.tar.gz: !binary |-
13
- MmJmYjFkMTI5MGNlYmZmNzcyYmM1ZDZhOWQ3NmU4YzE0MzIwZTIwM2MxNmI4
14
- Njc0MjI5MTIxNTUxOGU3YzAzMTc0MDcxYTAwZTQ3N2NmYmRlMTFhZDc0MTA2
15
- ZTdhZDQ1N2FiZTVhNTFhNTI0N2Y3NGNkODkwMGE2ZmY5YTUxNGY=
13
+ MGQ2Y2Y2MTU3MmQzNzExMWQ2MDZhMDBjOGY1MThhMzA2YTJkZjlkYmZkOGMw
14
+ MWYyZTAzYTdkMjFhNWZhZmYxMTEyNzNiNzA3MmI4MTdmZDFiOTJmOWRkNGVl
15
+ OGNjNDYzYjQ2MWJkM2ZmMDc3OWUxNTQ3NjRmOTdlZDM0YmFlYTE=
@@ -17,6 +17,16 @@ module YACCL
17
17
  attr_reader :changes_on_type
18
18
  attr_reader :root_folder_url
19
19
 
20
+ def ==(other)
21
+ return true if other.equal?(self)
22
+ return false unless other.kind_of?(self.class)
23
+ id == other.id
24
+ end
25
+
26
+ def to_s
27
+ name
28
+ end
29
+
20
30
  def self.create(raw_repository)
21
31
  Repository.new(raw_repository)
22
32
  end
@@ -11,8 +11,8 @@ module YACCL
11
11
  class BrowserBindingService
12
12
  def initialize(service_url, basic_auth_username=nil, basic_auth_password=nil, succinct_properties=true)
13
13
  @service_url = service_url
14
- @basic_auth_username = basic_auth_username
15
- @basic_auth_password = basic_auth_password
14
+ @basement = Basement.new(basic_auth_username, basic_auth_password)
15
+
16
16
  @succinct_properties = succinct_properties
17
17
 
18
18
  @repository_urls = LRUCache.new(ttl: 3600)
@@ -31,12 +31,12 @@ module YACCL
31
31
 
32
32
  response = if params.has_key?(:cmisaction)
33
33
  if params.has_key?(:content)
34
- Basement.multipart_post(url, params)
34
+ @basement.multipart_post(url, params)
35
35
  else
36
- Basement.post(url, body: params)
36
+ @basement.post(url, body: params)
37
37
  end
38
38
  else
39
- Basement.get(url, query: params)
39
+ @basement.get(url, query: params)
40
40
  end
41
41
 
42
42
  result = response.body
@@ -57,14 +57,14 @@ module YACCL
57
57
  else
58
58
  if object_id.nil?
59
59
  if @repository_urls.fetch(repository_id).nil?
60
- raise "No configuration found for <#{repository_id}>. Does repository exist?" unless Basement.get(@service_url)[repository_id]
61
- repository_url = Basement.get(@service_url)[repository_id]['repositoryUrl']
60
+ raise "No repository found with ID: #{repository_id}." unless @basement.get(@service_url)[repository_id]
61
+ repository_url = @basement.get(@service_url)[repository_id]['repositoryUrl']
62
62
  @repository_urls.store(repository_id, repository_url)
63
63
  end
64
64
  return @repository_urls.fetch(repository_id)
65
65
  else
66
66
  if @root_folder_urls.fetch(repository_id).nil?
67
- root_folder_url = Basement.get(@service_url)[repository_id]['rootFolderUrl']
67
+ root_folder_url = @basement.get(@service_url)[repository_id]['rootFolderUrl']
68
68
  @root_folder_urls.store(repository_id, root_folder_url)
69
69
  end
70
70
  return @root_folder_urls.fetch(repository_id)
@@ -109,12 +109,25 @@ module YACCL
109
109
 
110
110
  class Basement
111
111
  include HTTParty
112
- basic_auth @basic_auth_username, @basic_auth_password unless @basic_auth_username.nil?
113
112
 
114
- def self.multipart_post(url, options)
113
+ def initialize(user, pass)
114
+ @username = user
115
+ @password = pass
116
+ self.class.basic_auth(user, pass)
117
+ end
118
+
119
+ def get(*params)
120
+ self.class.get(*params)
121
+ end
122
+
123
+ def post(*params)
124
+ self.class.post(*params)
125
+ end
126
+
127
+ def multipart_post(url, options)
115
128
  url = URI.parse(url)
116
129
  req = Net::HTTP::Post::Multipart.new(url.path, options)
117
- req.basic_auth @basic_auth_username, @basic_auth_password unless @basic_auth_username.nil?
130
+ req.basic_auth @username, @password unless @username.nil?
118
131
  Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
119
132
  end
120
133
  end
@@ -1,3 +1,3 @@
1
1
  module YACCL
2
- VERSION = '0.0.19'
2
+ VERSION = '0.0.20'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaccl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Geerts