deadwood 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. data/README.md +65 -3
  2. data/Rakefile +2 -4
  3. data/lib/deadwood/active_resource_oauth_client.rb +16 -8
  4. data/lib/deadwood/model/activation_key.rb +24 -8
  5. data/lib/deadwood/model/base.rb +16 -9
  6. data/lib/deadwood/model/changeset.rb +18 -10
  7. data/lib/deadwood/model/consumer.rb +16 -8
  8. data/lib/deadwood/model/crl.rb +16 -8
  9. data/lib/deadwood/model/entitlement.rb +16 -8
  10. data/lib/deadwood/model/environment.rb +22 -20
  11. data/lib/deadwood/model/errata.rb +16 -8
  12. data/lib/deadwood/model/gpg_key.rb +21 -16
  13. data/lib/deadwood/model/organization.rb +16 -8
  14. data/lib/deadwood/model/pool.rb +16 -8
  15. data/lib/deadwood/model/product.rb +22 -13
  16. data/lib/deadwood/model/provider.rb +18 -9
  17. data/lib/deadwood/model/repository.rb +16 -8
  18. data/lib/deadwood/model/role.rb +21 -14
  19. data/lib/deadwood/model/status.rb +16 -8
  20. data/lib/deadwood/model/subscription.rb +16 -8
  21. data/lib/deadwood/model/system.rb +18 -9
  22. data/lib/deadwood/model/system_group.rb +22 -13
  23. data/lib/deadwood/model/task.rb +16 -8
  24. data/lib/deadwood/model/template.rb +18 -9
  25. data/lib/deadwood/model/user.rb +16 -8
  26. data/lib/deadwood/model/version.rb +16 -8
  27. data/rake/rpmtask.rb +16 -13
  28. data/spec/models/activation_key_spec.rb +48 -8
  29. data/spec/models/base_spec.rb +16 -8
  30. data/spec/models/changeset_spec.rb +16 -8
  31. data/spec/models/crl_spec.rb +16 -8
  32. data/spec/models/environment_spec.rb +16 -8
  33. data/spec/models/gpg_key_spec.rb +16 -8
  34. data/spec/models/organization_spec.rb +16 -8
  35. data/spec/models/product_spec.rb +16 -8
  36. data/spec/models/provider_spec.rb +16 -8
  37. data/spec/models/repository_spec.rb +16 -8
  38. data/spec/models/role_spec.rb +16 -8
  39. data/spec/models/system_group_spec.rb +16 -8
  40. data/spec/models/task_spec.rb +16 -8
  41. data/spec/models/template_spec.rb +16 -8
  42. data/spec/models/user_spec.rb +16 -8
  43. data/spec/spec_helper.rb +15 -21
  44. data/spec/vcr/cassettes/create_activation_key.yml +91 -91
  45. data/spec/vcr/cassettes/create_changeset.yml +93 -93
  46. data/spec/vcr/cassettes/create_find_all_environment.yml +45 -45
  47. data/spec/vcr/cassettes/create_find_by_id_activation_key.yml +214 -0
  48. data/spec/vcr/cassettes/create_find_single_environment.yml +49 -49
  49. data/spec/vcr/cassettes/create_gpg_key.yml +64 -64
  50. data/spec/vcr/cassettes/create_provider_for_default_org.yml +63 -63
  51. data/spec/vcr/cassettes/create_repository.yml +98 -98
  52. data/spec/vcr/cassettes/create_role.yml +46 -46
  53. data/spec/vcr/cassettes/create_system.yml +59 -59
  54. data/spec/vcr/cassettes/create_template.yml +86 -86
  55. data/spec/vcr/cassettes/create_update_activation_key.yml +345 -0
  56. data/spec/vcr/cassettes/create_user.yml +48 -48
  57. data/spec/vcr/cassettes/create_user_role.yml +103 -103
  58. data/spec/vcr/cassettes/find_ACME_Corporation.yml +14 -14
  59. data/spec/vcr/cassettes/find_admin.yml +14 -14
  60. data/spec/vcr/cassettes/find_crl.yml +22 -22
  61. data/spec/vcr/cassettes/find_template.yml +13 -13
  62. data/spec/vcr/cassettes/find_users.yml +13 -13
  63. data/spec/vcr/cassettes/organization_1_exists.yml +28 -28
  64. data/spec/vcr/cassettes/organization_create.yml +46 -46
  65. data/spec/vcr/cassettes/organization_default_exists.yml +14 -14
  66. data/spec/vcr/cassettes/organization_exists.yml +13 -13
  67. data/spec/vcr/cassettes/organization_update.yml +44 -44
  68. data/spec/vcr/cassettes/provider_1_exists.yml +14 -14
  69. data/spec/vcr/cassettes/providers_all_exists.yml +15 -15
  70. data/spec/vcr/cassettes/read_products.yml +92 -92
  71. data/spec/vcr/cassettes/update_environment_name_description.yml +83 -83
  72. data/spec/vcr/cassettes/update_provider_for_org.yml +64 -64
  73. data/spec/vcr/cassettes/update_role.yml +67 -67
  74. data/spec/vcr/cassettes/update_user.yml +48 -48
  75. data/spec/vcr_setup.rb +16 -23
  76. metadata +8 -32
data/README.md CHANGED
@@ -1,8 +1,70 @@
1
- = deadwood
1
+ # Deadwood
2
2
 
3
3
  Deadwood is a ruby client library to interact with a Katello server (http://katello.org/)
4
+ ## Katello API
5
+ [The katello api can be found here](https://fedorahosted.org/katello/wiki/ApiDocLatest)
4
6
 
5
- == Contributing to deadwood
7
+ ### [Currently tested](https://github.com/calfonso/deadwood/tree/master/spec/models) and known to work API implementation in Deadwood
8
+ * [Activation keys](https://github.com/calfonso/deadwood/blob/master/spec/models/activation_key_spec.rb)
9
+ * index
10
+ * show
11
+ * create
12
+ * update
13
+ * destroy
14
+ * [Changesets](https://github.com/calfonso/deadwood/blob/master/spec/models/changeset_spec.rb)
15
+ * index
16
+ * create
17
+ * destroy
18
+ * [Crl](https://github.com/calfonso/deadwood/blob/master/spec/models/crl_spec.rb)
19
+ * index
20
+ * [Environments](https://github.com/calfonso/deadwood/blob/master/spec/models/environment_spec.rb)
21
+ * index
22
+ * show
23
+ * create
24
+ * update
25
+ * destroy
26
+ * [Gpg keys](https://github.com/calfonso/deadwood/blob/master/spec/models/gpg_key_spec.rb)
27
+ * show
28
+ * create
29
+ * update
30
+ * destroy
31
+ * [Organizations](https://github.com/calfonso/deadwood/blob/master/spec/models/organization_spec.rb)
32
+ * index
33
+ * show
34
+ * create
35
+ * update
36
+ * destroy
37
+ * [Products](https://github.com/calfonso/deadwood/blob/master/spec/models/product_spec.rb)
38
+ * show
39
+ * index
40
+ * destroy
41
+ * [Repositories](https://github.com/calfonso/deadwood/blob/master/spec/models/repository_spec.rb)
42
+ * create
43
+ * show
44
+ * destroy
45
+ * [Roles](https://github.com/calfonso/deadwood/blob/master/spec/models/role_spec.rb)
46
+ * index
47
+ * show
48
+ * create
49
+ * update
50
+ * destroy
51
+ * [System groups](https://github.com/calfonso/deadwood/blob/master/spec/models/system_group_spec.rb)
52
+ * index
53
+ * create
54
+ * destroy
55
+ * [Users](https://github.com/calfonso/deadwood/blob/master/spec/models/user_spec.rb)
56
+ * index
57
+ * create
58
+ * update
59
+ * destroy
60
+ * [Task](https://github.com/calfonso/deadwood/blob/master/spec/models/task_spec.rb)
61
+ * index
62
+ * [Templates](https://github.com/calfonso/deadwood/blob/master/spec/models/template_spec.rb)
63
+ * index
64
+ * create
65
+ * destroy
66
+
67
+ ## Contributing to deadwood
6
68
 
7
69
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
70
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
@@ -12,7 +74,7 @@ Deadwood is a ruby client library to interact with a Katello server (http://kate
12
74
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
75
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
76
 
15
- == Copyright
77
+ ## Copyright
16
78
 
17
79
  Copyright (c) 2012 Chris Alfonso. See COPYING for
18
80
  further details.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require './rake/rpmtask'
12
12
  RPMBUILD_DIR = "#{File.expand_path('~')}/rpmbuild"
13
13
  RPM_SPEC = "rubygem-deadwood.spec"
14
14
  RPM_SPEC_IN = "rubygem-deadwood.spec.in"
15
- PKG_VERSION = "0.0.1"
15
+ PKG_VERSION = "0.0.3"
16
16
 
17
17
  spec = Gem::Specification.new do |s|
18
18
  s.name = 'deadwood'
@@ -21,14 +21,12 @@ spec = Gem::Specification.new do |s|
21
21
  s.description = 'Ruby client for interacting with a Katello server'
22
22
  s.author = 'Chris Alfonso'
23
23
  s.email = 'calfonso@redhat.com'
24
- s.license = 'ASL 2.0'
24
+ s.license = 'MIT'
25
25
  s.homepage = 'http://aeolusproject.org'
26
26
 
27
27
  s.files = Dir["{lib}/**/*.rb", "COPYING", "*.md", "Rakefile", "rake/rpmtask.rb"]
28
28
  s.test_files = Dir["spec/**/*.*", "examples/deadwood-config.yml"]
29
29
  s.require_path = "lib"
30
- s.add_dependency('nokogiri', '>=0.4.0')
31
- s.add_dependency('rest-client')
32
30
  s.add_dependency('activeresource', '~>3.0.10')
33
31
  s.add_dependency('oauth')
34
32
  s.add_development_dependency('rspec', '~>1.3.0')
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  require 'oauth'
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -19,6 +27,14 @@ module Deadwood
19
27
  attributes.delete(:environment_id)
20
28
  "#{self.class.prefix(prefix_options)}#{self.class.collection_name}#{query_string(query_options)}"
21
29
  end
30
+
31
+ def element_path(id = self.id, prefix_options = {}, query_options = nil)
32
+ black_list = Array[:organization_id, :pools, :usage_count, :user_id, :updated_at, :created_at]
33
+ prefix_options, query_options = split_options(prefix_options) if query_options.nil?
34
+ # Remove the attributes that aren't allowed to be updated
35
+ black_list.each {|x| attributes.delete(x)}
36
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
37
+ end
22
38
  end
23
39
  end
24
40
  end
@@ -1,15 +1,22 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
-
13
20
  module Deadwood
14
21
  module Katello
15
22
  class Base < ActiveResource::Base
@@ -1,26 +1,34 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
14
22
  module Katello
15
23
  class Changeset < Base
16
24
  def collection_path(prefix_options = {}, query_options = nil)
25
+ black_list = Array[:organization_id, :environment_id]
17
26
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
18
27
  query_options.merge!(self.attributes)
19
28
  org_id = self.organization_id
20
29
  env_id = self.environment_id
21
30
  # Remove the attributes that aren't allowed to be updated
22
- attributes.delete(:organization_id)
23
- attributes.delete(:environment_id)
31
+ black_list.each {|x| attributes.delete(x)}
24
32
  "#{self.class.prefix(prefix_options)}organizations/#{org_id}/environments/#{env_id}/#{self.class.collection_name}#{query_string(query_options)}"
25
33
  end
26
34
  end
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -22,18 +30,12 @@ module Deadwood
22
30
  end
23
31
 
24
32
  def element_path(id = self.id, prefix_options = {}, query_options = nil)
25
- prefix_options, query_options = split_options(prefix_options) if query_options.nil?
26
- org_id = self.organization
27
- # Remove the attributes that aren't allowed to be updated
28
- attributes.delete(:organization_id)
29
- attributes.delete(:organization)
30
- attributes.delete(:library)
31
- attributes.delete(:updated_at)
32
- attributes.delete(:created_at)
33
- attributes.delete(:prior_id)
34
- attributes.delete(:prior)
35
- attributes.delete(:name)
36
- "#{self.class.prefix(prefix_options)}organizations/#{org_id}/#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
33
+ black_list = Array[:organization_id, :organization, :library, :updated_at, :created_at, :prior_id, :prior, :name]
34
+ prefix_options, query_options = split_options(prefix_options) if query_options.nil?
35
+ org_id = self.organization
36
+ # Remove the attributes that aren't allowed to be updated
37
+ black_list.each {|x| attributes.delete(x)}
38
+ "#{self.class.prefix(prefix_options)}organizations/#{org_id}/#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
37
39
  end
38
40
  end
39
41
  end
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -1,13 +1,21 @@
1
1
  # Copyright (c) 2012 Chris Alfonso
2
- # # Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
3
4
  # of this software and associated documentation files (the "Software"), to deal
4
- # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
- # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
6
- # # The above copyright notice and this permission notice shall be included in
7
- # all copies or substantial portions of the Software. #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
11
19
  # THE SOFTWARE.
12
20
 
13
21
  module Deadwood
@@ -22,14 +30,11 @@ module Deadwood
22
30
  end
23
31
 
24
32
  def element_path(id = self.id, prefix_options = {}, query_options = nil)
25
- prefix_options, query_options = split_options(prefix_options) if query_options.nil?
26
- # Remove the attributes that aren't allowed to be updated
27
- attributes.delete(:organization_id)
28
- attributes.delete(:products)
29
- attributes.delete(:updated_at)
30
- attributes.delete(:created_at)
31
- attributes.delete(:repositories)
32
- "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
33
+ black_list = Array[:organization_id, :products, :updated_at, :created_at, :repositories]
34
+ prefix_options, query_options = split_options(prefix_options) if query_options.nil?
35
+ # Remove the attributes that aren't allowed to be updated
36
+ black_list.each {|x| attributes.delete(x)}
37
+ "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
33
38
  end
34
39
 
35
40
  end