crowbar-client 2.4.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/lib/crowbar/client/app/repository.rb +12 -10
  4. data/lib/crowbar/client/app/role.rb +2 -2
  5. data/lib/crowbar/client/command/proposal/create.rb +2 -2
  6. data/lib/crowbar/client/command/repository/list.rb +8 -5
  7. data/lib/crowbar/client/command/role/show.rb +2 -2
  8. data/lib/crowbar/client/config.rb +1 -1
  9. data/lib/crowbar/client/mixin/barclamp.rb +1 -1
  10. data/lib/crowbar/client/request.rb +3 -3
  11. data/lib/crowbar/client/request/backup/create.rb +16 -2
  12. data/lib/crowbar/client/request/backup/delete.rb +15 -1
  13. data/lib/crowbar/client/request/backup/download.rb +3 -3
  14. data/lib/crowbar/client/request/backup/list.rb +15 -1
  15. data/lib/crowbar/client/request/backup/restore.rb +15 -1
  16. data/lib/crowbar/client/request/backup/upload.rb +23 -7
  17. data/lib/crowbar/client/request/base.rb +35 -53
  18. data/lib/crowbar/client/request/batch/build.rb +5 -4
  19. data/lib/crowbar/client/request/proposal/create.rb +1 -1
  20. data/lib/crowbar/client/request/repository/activate.rb +1 -0
  21. data/lib/crowbar/client/request/repository/deactivate.rb +1 -0
  22. data/lib/crowbar/client/request/rest.rb +45 -0
  23. data/lib/crowbar/client/util.rb +3 -0
  24. data/lib/crowbar/client/util/apiversion.rb +36 -0
  25. data/lib/crowbar/client/version.rb +3 -3
  26. data/spec/crowbar/client/command/proposal/create_spec.rb +3 -3
  27. data/spec/crowbar/client/command/proposal/edit_spec.rb +3 -3
  28. data/spec/crowbar/client/request/backup/create_spec.rb +6 -4
  29. data/spec/crowbar/client/request/backup/delete_spec.rb +3 -3
  30. data/spec/crowbar/client/request/backup/download_spec.rb +1 -1
  31. data/spec/crowbar/client/request/backup/list_spec.rb +3 -3
  32. data/spec/crowbar/client/request/backup/restore_spec.rb +3 -3
  33. data/spec/crowbar/client/request/backup/upload_spec.rb +13 -4
  34. data/spec/crowbar/client/request/batch/build_spec.rb +7 -1
  35. data/spec/crowbar/client/request/repository/activate_spec.rb +2 -0
  36. data/spec/crowbar/client/request/repository/deactivate_spec.rb +2 -0
  37. data/spec/support/request_examples.rb +12 -14
  38. metadata +118 -104
  39. data/lib/crowbar/client/request/party.rb +0 -82
@@ -1,82 +0,0 @@
1
- #
2
- # Copyright 2015, SUSE Linux GmbH
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require "httmultiparty"
18
-
19
- module Crowbar
20
- module Client
21
- module Request
22
- #
23
- # Client for executing the HTTP API requests
24
- #
25
- class Party
26
- include HTTMultiParty
27
-
28
- follow_redirects true
29
- format :json
30
-
31
- def initialize
32
- self.class.base_uri(
33
- config.server
34
- )
35
-
36
- self.class.default_timeout(
37
- config.timeout
38
- )
39
-
40
- self.class.digest_auth(
41
- config.username,
42
- config.password
43
- ) if should_auth
44
-
45
- self.class.debug_output(
46
- $stderr
47
- ) if should_debug
48
- end
49
-
50
- def config
51
- @config ||= Config
52
- end
53
-
54
- def method_missing(method, *arguments, &block)
55
- if self.class.respond_to?(method, true)
56
- self.class.send(method, *arguments, &block)
57
- else
58
- super
59
- end
60
- end
61
-
62
- def respond_to?(method_sym, include_private = false)
63
- if self.class.respond_to?(method, true)
64
- true
65
- else
66
- super
67
- end
68
- end
69
-
70
- protected
71
-
72
- def should_auth
73
- !config.anonymous
74
- end
75
-
76
- def should_debug
77
- config.debug
78
- end
79
- end
80
- end
81
- end
82
- end