foreman_api 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/foreman_api.gemspec CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = ForemanApi::VERSION
17
17
 
18
+ gem.add_dependency 'apipie-rails', '~> 0.0.12'
18
19
  gem.add_dependency 'json'
19
20
  gem.add_dependency 'rest-client', '>= 1.6.1'
20
21
  gem.add_dependency 'oauth'
@@ -0,0 +1,6 @@
1
+ ---
2
+ :base_url: http://localhost:3000
3
+ :enable_validations: false
4
+ :oauth:
5
+ :consumer_key: consumer
6
+ :consumer_secret: shhhh
@@ -0,0 +1 @@
1
+ {"docs":{"info":"<p>The Foreman is aimed to be a single address for all machines life cycle management.</p>\n","doc_url":"/apidoc","api_url":"/api","copyright":"","name":"Foreman","resources":{"architectures":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all architectures.","http_method":"GET","api_url":"/api/architectures"}],"doc_url":"/apidoc/architectures/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be an identifier, string from 2 to 128 characters containting only alphanumeric characters, space, '_', '-' with no leading or trailing space..","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show an architecture.","http_method":"GET","api_url":"/api/architectures/:id"}],"doc_url":"/apidoc/architectures/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"architecture[name]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"architecture","expected_type":"hash","full_name":"architecture"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create an architecture.","http_method":"POST","api_url":"/api/architectures"}],"doc_url":"/apidoc/architectures/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"name","expected_type":"string","full_name":"architecture[name]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"architecture","expected_type":"hash","full_name":"architecture"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update an architecture.","http_method":"PUT","api_url":"/api/architectures/:id"}],"doc_url":"/apidoc/architectures/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete an architecture.","http_method":"DELETE","api_url":"/api/architectures/:id"}],"doc_url":"/apidoc/architectures/destroy","name":"destroy","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/architectures","name":"Architectures","api_url":"/api","formats":[]},"users":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all users.","http_method":"GET","api_url":"/api/users"}],"doc_url":"/apidoc/users/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show an user.","http_method":"GET","api_url":"/api/users/:id"}],"doc_url":"/apidoc/users/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"login","expected_type":"string","full_name":"user[login]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"firstname","expected_type":"string","full_name":"user[firstname]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"lastname","expected_type":"string","full_name":"user[lastname]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"mail","expected_type":"string","full_name":"user[mail]"},{"description":"<p>Is an admin account?</p>\n","allow_nil":false,"required":false,"validator":"Must be 'true' or 'false'","name":"admin","expected_type":"string","full_name":"user[admin]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"password","expected_type":"string","full_name":"user[password]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be Integer","name":"auth_source_id","expected_type":"numeric","full_name":"user[auth_source_id]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"user","expected_type":"hash","full_name":"user"}],"errors":[],"examples":[],"full_description":"<p>Adds role &#39;Anonymous&#39; to the user by default</p>\n","see":null,"apis":[{"short_description":"Create an user.","http_method":"POST","api_url":"/api/users"}],"doc_url":"/apidoc/users/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"login","expected_type":"string","full_name":"user[login]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"firstname","expected_type":"string","full_name":"user[firstname]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"lastname","expected_type":"string","full_name":"user[lastname]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"mail","expected_type":"string","full_name":"user[mail]"},{"description":"<p>Is an admin account?</p>\n","allow_nil":false,"required":false,"validator":"Must be 'true' or 'false'","name":"admin","expected_type":"string","full_name":"user[admin]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"password","expected_type":"string","full_name":"user[password]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"user","expected_type":"hash","full_name":"user"}],"errors":[],"examples":[],"full_description":"<p>Adds role &#39;Anonymous&#39; to the user if it is not already present.\nOnly admin can set admin account.</p>\n","see":null,"apis":[{"short_description":"Update an user.","http_method":"PUT","api_url":"/api/users/:id"}],"doc_url":"/apidoc/users/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete an user.","http_method":"DELETE","api_url":"/api/users/:id"}],"doc_url":"/apidoc/users/destroy","name":"destroy","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/users","name":"Users","api_url":"/api","formats":[]},"operatingsystems":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>for example, name ASC, or name DESC</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all operating systems.","http_method":"GET","api_url":"/api/operatingsystems"}],"doc_url":"/apidoc/operatingsystems/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show an OS.","http_method":"GET","api_url":"/api/operatingsystems/:id"}],"doc_url":"/apidoc/operatingsystems/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must match regular expression /\\A(\\S+)\\Z/.","name":"name","expected_type":"string","full_name":"operatingsystem[name]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"major","expected_type":"string","full_name":"operatingsystem[major]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"minor","expected_type":"string","full_name":"operatingsystem[minor]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"operatingsystem","expected_type":"hash","full_name":"operatingsystem"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create an OS.","http_method":"POST","api_url":"/api/operatingsystems"}],"doc_url":"/apidoc/operatingsystems/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"","allow_nil":false,"required":false,"validator":"Must match regular expression /\\A(\\S+)\\Z/.","name":"name","expected_type":"string","full_name":"operatingsystem[name]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"major","expected_type":"string","full_name":"operatingsystem[major]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"minor","expected_type":"string","full_name":"operatingsystem[minor]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"operatingsystem","expected_type":"hash","full_name":"operatingsystem"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update an OS.","http_method":"PUT","api_url":"/api/operatingsystems/:id"}],"doc_url":"/apidoc/operatingsystems/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a bookmark.","http_method":"DELETE","api_url":"/api/operatingsystems/:id"}],"doc_url":"/apidoc/operatingsystems/destroy","name":"destroy","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"medium","expected_type":"string","full_name":"medium"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"architecture","expected_type":"string","full_name":"architecture"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List boot files an OS.","http_method":"GET","api_url":"/api/operatingsystems/:id/bootfiles"}],"doc_url":"/apidoc/operatingsystems/bootfiles","name":"bootfiles","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/operatingsystems","name":"Operating systems","api_url":"/api","formats":[]},"bookmarks":{"version":"1","methods":[{"see_url":null,"params":[],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all bookmarks.","http_method":"GET","api_url":"/api/bookmarks"}],"doc_url":"/apidoc/bookmarks/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show a bookmark.","http_method":"GET","api_url":"/api/bookmarks/:id"}],"doc_url":"/apidoc/bookmarks/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"bookmark[name]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"controller","expected_type":"string","full_name":"bookmark[controller]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"query","expected_type":"string","full_name":"bookmark[query]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"bookmark","expected_type":"hash","full_name":"bookmark"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create a bookmark.","http_method":"POST","api_url":"/api/bookmarks"}],"doc_url":"/apidoc/bookmarks/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"name","expected_type":"string","full_name":"bookmark[name]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"controller","expected_type":"string","full_name":"bookmark[controller]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"query","expected_type":"string","full_name":"bookmark[query]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"bookmark","expected_type":"hash","full_name":"bookmark"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update a bookmark.","http_method":"PUT","api_url":"/api/bookmarks/:id"}],"doc_url":"/apidoc/bookmarks/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a bookmark.","http_method":"DELETE","api_url":"/api/bookmarks/:id"}],"doc_url":"/apidoc/bookmarks/destroy","name":"destroy","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/bookmarks","name":"Bookmarks","api_url":"/api","formats":[]},"domains":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>Filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>Sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List of domains","http_method":"GET","api_url":"/api/domains"}],"doc_url":"/apidoc/domains/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show a domain.","http_method":"GET","api_url":"/api/domains/:id"}],"doc_url":"/apidoc/domains/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"<p>The full DNS Domain name</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"domain[name]"},{"description":"<p>Full name describing the domain</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"fullname","expected_type":"string","full_name":"domain[fullname]"},{"description":"<p>DNS Proxy to use within this domain</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"dns_id","expected_type":"string","full_name":"domain[dns_id]"},{"description":"<p>Array of parameters (name, value)</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"domain_parameters_attributes","expected_type":"string","full_name":"domain[domain_parameters_attributes]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"domain","expected_type":"hash","full_name":"domain"}],"errors":[],"examples":[],"full_description":"<p>The <b>fullname</b> field is used for human readability in reports\nand other pages that refer to domains, and also available as\nan external node parameter</p>\n","see":null,"apis":[{"short_description":"Create a domain.","http_method":"POST","api_url":"/api/domains"}],"doc_url":"/apidoc/domains/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"<p>The full DNS Domain name</p>\n","allow_nil":true,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"domain[name]"},{"description":"<p>Full name describing the domain</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"fullname","expected_type":"string","full_name":"domain[fullname]"},{"description":"<p>DNS Proxy to use within this domain</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"dns_id","expected_type":"string","full_name":"domain[dns_id]"},{"description":"<p>Array of parameters (name, value)</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"domain_parameters_attributes","expected_type":"string","full_name":"domain[domain_parameters_attributes]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"domain","expected_type":"hash","full_name":"domain"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update a domain.","http_method":"PUT","api_url":"/api/domains/:id"}],"doc_url":"/apidoc/domains/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a domain.","http_method":"DELETE","api_url":"/api/domains/:id"}],"doc_url":"/apidoc/domains/destroy","name":"destroy","formats":[]}],"full_description":"<p>Foreman considers a domain and a DNS zone as the same thing. That is, if you\nare planning to manage a site where all the machines are or the form\n<i>hostname</i>.<b>somewhere.com</b> then the domain is <b>somewhere.com</b>.\nThis allows Foreman to associate a puppet variable with a domain/site\nand automatically append this variable to all external node requests made\nby machines at that site.</p>\n","short_description":"","doc_url":"/apidoc/domains","name":"Domains","api_url":"/api","formats":[]},"media":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>for example, name ASC, or name DESC</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all media.","http_method":"GET","api_url":"/api/media"}],"doc_url":"/apidoc/media/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show a medium.","http_method":"GET","api_url":"/api/media/:id"}],"doc_url":"/apidoc/media/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"<p>Name of media</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"medium[name]"},{"description":"<p>The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).</p>\n\n<p>for example http://mirror.averse.net/centos/$version/os/$arch\nwhere $arch will be substituted for the host&#39;s actual OS architecture and $version, $major and $minor\nwill be substituted for the version of the operating system.</p>\n\n<p>Solaris and Debian media may also use $release.</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"path","expected_type":"string","full_name":"medium[path]"},{"description":"<p>The family that the operating system belongs to.</p>\n\n<p>Available families:</p>\n\n<ul>\n<li>Archlinux</li>\n<li>Debian</li>\n<li>Redhat</li>\n<li>Solaris</li>\n<li>Suse</li>\n<li>Windows</li>\n</ul>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"os_family","expected_type":"string","full_name":"medium[os_family]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"medium","expected_type":"hash","full_name":"medium"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create a medium.","http_method":"POST","api_url":"/api/medium"}],"doc_url":"/apidoc/media/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"<p>Name of media</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"name","expected_type":"string","full_name":"medium[name]"},{"description":"<p>The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).</p>\n\n<p>for example http://mirror.averse.net/centos/$version/os/$arch\nwhere $arch will be substituted for the host&#39;s actual OS architecture and $version, $major and $minor\nwill be substituted for the version of the operating system.</p>\n\n<p>Solaris and Debian media may also use $release.</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"path","expected_type":"string","full_name":"medium[path]"},{"description":"<p>The family that the operating system belongs to.</p>\n\n<p>Available families:</p>\n\n<ul>\n<li>Archlinux</li>\n<li>Debian</li>\n<li>Redhat</li>\n<li>Solaris</li>\n<li>Suse</li>\n<li>Windows</li>\n</ul>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"os_family","expected_type":"string","full_name":"medium[os_family]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"medium","expected_type":"hash","full_name":"medium"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update a medium.","http_method":"PUT","api_url":"/api/media/:id"}],"doc_url":"/apidoc/media/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a medium.","http_method":"DELETE","api_url":"/api/media/:id"}],"doc_url":"/apidoc/media/destroy","name":"destroy","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/media","name":"Media","api_url":"/api","formats":[]},"dashboard":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Get Dashboard results","http_method":"GET","api_url":"/api/dashboard"}],"doc_url":"/apidoc/dashboard/index","name":"index","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/dashboard","name":"Dashboard","api_url":"/api","formats":[]},"subnets":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>Filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>Sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List of subnets","http_method":"GET","api_url":"/api/subnets"}],"doc_url":"/apidoc/subnets/index","name":"index","formats":[]},{"see_url":null,"params":[{"params":[{"description":"<p>Subnet name</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"subnet[name]"},{"description":"<p>Subnet network</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"network","expected_type":"string","full_name":"subnet[network]"},{"description":"<p>Netmask for this subnet</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"mask","expected_type":"string","full_name":"subnet[mask]"},{"description":"<p>Primary DNS for this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"gateway","expected_type":"string","full_name":"subnet[gateway]"},{"description":"<p>Primary DNS for this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"dns_primary","expected_type":"string","full_name":"subnet[dns_primary]"},{"description":"<p>Secondary DNS for this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"dns_secondary","expected_type":"string","full_name":"subnet[dns_secondary]"},{"description":"<p>Starting IP Address for IP auto suggestion</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"from","expected_type":"string","full_name":"subnet[from]"},{"description":"<p>Ending IP Address for IP auto suggestion</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"to","expected_type":"string","full_name":"subnet[to]"},{"description":"<p>VLAN ID for this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"vlanid","expected_type":"string","full_name":"subnet[vlanid]"},{"description":"<p>Domains in which this subnet is part</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"domain_ids","expected_type":"string","full_name":"subnet[domain_ids]"},{"description":"<p>DHCP Proxy to use within this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be a number.","name":"dhcp_id","expected_type":"string","full_name":"subnet[dhcp_id]"},{"description":"<p>TFTP Proxy to use within this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be a number.","name":"tftp_id","expected_type":"string","full_name":"subnet[tftp_id]"},{"description":"<p>DNS Proxy to use within this subnet</p>\n","allow_nil":false,"required":false,"validator":"Must be a number.","name":"dns_id","expected_type":"string","full_name":"subnet[dns_id]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"subnet","expected_type":"hash","full_name":"subnet"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create a subnet","http_method":"POST","api_url":"/api/subnets"}],"doc_url":"/apidoc/subnets/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"<p>Subnet numeric identifier</p>\n","allow_nil":false,"required":true,"validator":"Must be a number.","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"<p>Subnet name</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"subnet[name]"},{"description":"<p>Subnet network</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"network","expected_type":"string","full_name":"subnet[network]"},{"description":"<p>Netmask for this subnet</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"mask","expected_type":"string","full_name":"subnet[mask]"},{"description":"<p>Primary DNS for this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"gateway","expected_type":"string","full_name":"subnet[gateway]"},{"description":"<p>Primary DNS for this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"dns_primary","expected_type":"string","full_name":"subnet[dns_primary]"},{"description":"<p>Secondary DNS for this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"dns_secondary","expected_type":"string","full_name":"subnet[dns_secondary]"},{"description":"<p>Starting IP Address for IP auto suggestion</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"from","expected_type":"string","full_name":"subnet[from]"},{"description":"<p>Ending IP Address for IP auto suggestion</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"to","expected_type":"string","full_name":"subnet[to]"},{"description":"<p>VLAN ID for this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be String","name":"vlanid","expected_type":"string","full_name":"subnet[vlanid]"},{"description":"<p>Domains in which this subnet is part</p>\n","allow_nil":true,"required":false,"validator":"Must be Array","name":"domain_ids","expected_type":"string","full_name":"subnet[domain_ids]"},{"description":"<p>DHCP Proxy to use within this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"dhcp_id","expected_type":"string","full_name":"subnet[dhcp_id]"},{"description":"<p>TFTP Proxy to use within this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"tftp_id","expected_type":"string","full_name":"subnet[tftp_id]"},{"description":"<p>DNS Proxy to use within this subnet</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"dns_id","expected_type":"string","full_name":"subnet[dns_id]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"subnet","expected_type":"hash","full_name":"subnet"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update a subnet","http_method":"PUT","api_url":"/api/subnets/:id"}],"doc_url":"/apidoc/subnets/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"<p>Subnet numeric identifier</p>\n","allow_nil":false,"required":true,"validator":"Must be a number.","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a subnet","http_method":"DELETE","api_url":"/api/subnets/:id"}],"doc_url":"/apidoc/subnets/destroy","name":"destroy","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":false,"validator":"Must be a number.","name":"subnet_id","expected_type":"string","full_name":"subnet_id"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"host_mac","expected_type":"string","full_name":"host_mac"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Query subnet DHCP proxy for an unused IP","http_method":"POST","api_url":"/api/subnets/freeip"}],"doc_url":"/apidoc/subnets/freeip","name":"freeip","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/subnets","name":"Subnets","api_url":"/api","formats":[]},"home":{"version":"1","methods":[{"see_url":null,"params":[],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show available links.","http_method":"GET","api_url":"/api"}],"doc_url":"/apidoc/home/index","name":"index","formats":[]},{"see_url":null,"params":[],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show status.","http_method":"GET","api_url":"/api/status"}],"doc_url":"/apidoc/home/status","name":"status","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/home","name":"Home","api_url":"/api","formats":[]},"config_templates":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List templates","http_method":"GET","api_url":"/api/config_templates"}],"doc_url":"/apidoc/config_templates/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show template details","http_method":"GET","api_url":"/api/config_templates/:id"}],"doc_url":"/apidoc/config_templates/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"<p>template name</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"config_template[name]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"template","expected_type":"string","full_name":"config_template[template]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be 'true' or 'false'","name":"snippet","expected_type":"string","full_name":"config_template[snippet]"},{"description":"","allow_nil":true,"required":false,"validator":"Must be String","name":"audit_comment","expected_type":"string","full_name":"config_template[audit_comment]"},{"description":"<p>not relevant for snippet</p>\n","allow_nil":true,"required":false,"validator":"Must be a number.","name":"template_kind_id","expected_type":"string","full_name":"config_template[template_kind_id]"},{"description":"<p>Array of template combinations (hostgroup<em>id, environment</em>id)</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"template_combinations_attributes","expected_type":"string","full_name":"config_template[template_combinations_attributes]"},{"description":"<p>Array of operating systems ID to associate the template with</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"operatingsystem_ids","expected_type":"string","full_name":"config_template[operatingsystem_ids]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"config_template","expected_type":"hash","full_name":"config_template"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create a template","http_method":"POST","api_url":"/api/config_templates"}],"doc_url":"/apidoc/config_templates/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"<p>template name</p>\n","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"config_template[name]"},{"description":"","allow_nil":false,"required":true,"validator":"Must be one of: String, File.","name":"template","expected_type":"string","full_name":"config_template[template]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be 'true' or 'false'","name":"snippet","expected_type":"string","full_name":"config_template[snippet]"},{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"audit_comment","expected_type":"string","full_name":"config_template[audit_comment]"},{"description":"<p>not relevant for snippet</p>\n","allow_nil":false,"required":false,"validator":"Must be a number.","name":"template_kind_id","expected_type":"string","full_name":"config_template[template_kind_id]"},{"description":"<p>Array of template combinations (hostgroup<em>id, environment</em>id)</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"template_combinations_attributes","expected_type":"string","full_name":"config_template[template_combinations_attributes]"},{"description":"<p>Array of operating systems ID to associate the template with</p>\n","allow_nil":false,"required":false,"validator":"Must be Array","name":"operatingsystem_ids","expected_type":"string","full_name":"config_template[operatingsystem_ids]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"config_template","expected_type":"hash","full_name":"config_template"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update a template","http_method":"PUT","api_url":"/api/config_templates/:id"}],"doc_url":"/apidoc/config_templates/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"<p>template version</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"version","expected_type":"string","full_name":"version"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":null,"http_method":"GET","api_url":"/api/config_templates/revision"}],"doc_url":"/apidoc/config_templates/revision","name":"revision","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete a template","http_method":"DELETE","api_url":"/api/config_templates/:id"}],"doc_url":"/apidoc/config_templates/destroy","name":"destroy","formats":[]},{"see_url":null,"params":[],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Change the default PXE menu on all configured TFTP servers","http_method":"GET","api_url":"/api/config_templates/build_pxe_default"}],"doc_url":"/apidoc/config_templates/build_pxe_default","name":"build_pxe_default","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/config_templates","name":"Config templates","api_url":"/api","formats":[]},"environments":{"version":"1","methods":[{"see_url":null,"params":[{"description":"<p>Filter results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"search","expected_type":"string","full_name":"search"},{"description":"<p>Sort results</p>\n","allow_nil":false,"required":false,"validator":"Must be String","name":"order","expected_type":"string","full_name":"order"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"List all environments.","http_method":"GET","api_url":"/api/environments"}],"doc_url":"/apidoc/environments/index","name":"index","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Show an environment.","http_method":"GET","api_url":"/api/environments/:id"}],"doc_url":"/apidoc/environments/show","name":"show","formats":[]},{"see_url":null,"params":[{"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"name","expected_type":"string","full_name":"environment[name]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"environment","expected_type":"hash","full_name":"environment"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Create an environment.","http_method":"POST","api_url":"/api/environments"}],"doc_url":"/apidoc/environments/create","name":"create","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"},{"params":[{"description":"","allow_nil":false,"required":false,"validator":"Must be String","name":"name","expected_type":"string","full_name":"environment[name]"}],"description":"","allow_nil":false,"required":true,"validator":"Must be a Hash","name":"environment","expected_type":"hash","full_name":"environment"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Update an environment.","http_method":"PUT","api_url":"/api/environments/:id"}],"doc_url":"/apidoc/environments/update","name":"update","formats":[]},{"see_url":null,"params":[{"description":"","allow_nil":false,"required":true,"validator":"Must be String","name":"id","expected_type":"string","full_name":"id"}],"errors":[],"examples":[],"full_description":"","see":null,"apis":[{"short_description":"Delete an environment.","http_method":"DELETE","api_url":"/api/environments/:id"}],"doc_url":"/apidoc/environments/destroy","name":"destroy","formats":[]}],"full_description":"","short_description":"","doc_url":"/apidoc/environments","name":"Environments","api_url":"/api","formats":[]}}}}
@@ -1,27 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Architecture < ForemanApi::Base
3
+ class Architecture < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["architectures"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- call(:get, "/api/architectures", :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/architectures", params
15
+ call(:"get", url, params, headers)
7
16
  end
8
17
 
9
- def show(id, params = {}, headers = {})
10
- call(:get, "/api/architectures/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/architectures/:id", params
25
+ call(:"get", url, params, headers)
11
26
  end
12
27
 
13
- def create(params = {}, headers = {})
14
- validate_params!(params, {"architecture"=>["name"]})
15
- call(:post, "/api/architectures", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"architecture"=>["name"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/architectures", params
35
+ call(:"post", url, params, headers)
16
36
  end
17
37
 
18
- def update(id, params = {}, headers = {})
19
- validate_params!(params, {"architecture"=>["name"]})
20
- call(:put, "/api/architectures/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "architecture"=>["name"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/architectures/:id", params
45
+ call(:"put", url, params, headers)
21
46
  end
22
47
 
23
- def destroy(id, params = {}, headers = {})
24
- call(:delete, "/api/architectures/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/architectures/:id", params
55
+ call(:"delete", url, params, headers)
25
56
  end
26
57
 
27
58
  end
@@ -1,27 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Bookmark < ForemanApi::Base
3
+ class Bookmark < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["bookmarks"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- call(:get, "/api/bookmarks", :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: []
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => false, :method => __method__
14
+ url, params = fill_params_in_url "/api/bookmarks", params
15
+ call(:"get", url, params, headers)
7
16
  end
8
17
 
9
- def show(id, params = {}, headers = {})
10
- call(:get, "/api/bookmarks/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/bookmarks/:id", params
25
+ call(:"get", url, params, headers)
11
26
  end
12
27
 
13
- def create(params = {}, headers = {})
14
- validate_params!(params, {"bookmark"=>["name", "controller", "query"]})
15
- call(:post, "/api/bookmarks", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"bookmark"=>["name", "controller", "query"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/bookmarks", params
35
+ call(:"post", url, params, headers)
16
36
  end
17
37
 
18
- def update(id, params = {}, headers = {})
19
- validate_params!(params, {"bookmark"=>["name", "controller", "query"]})
20
- call(:put, "/api/bookmarks/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "bookmark"=>["name", "controller", "query"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/bookmarks/:id", params
45
+ call(:"put", url, params, headers)
21
46
  end
22
47
 
23
- def destroy(id, params = {}, headers = {})
24
- call(:delete, "/api/bookmarks/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/bookmarks/:id", params
55
+ call(:"delete", url, params, headers)
25
56
  end
26
57
 
27
58
  end
@@ -1,37 +1,78 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class ConfigTemplate < ForemanApi::Base
3
+ class ConfigTemplate < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["config_templates"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search", "order"])
7
- call(:get, "/api/config_templates", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/config_templates", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
- def show(id, params = {}, headers = {})
11
- call(:get, "/api/config_templates/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/config_templates/:id", params
25
+ call(:"get", url, params, headers)
12
26
  end
13
27
 
14
- def create(params = {}, headers = {})
15
- validate_params!(params, {"config_template"=>["name", "template", "snippet", "audit_comment", "template_kind_id", "template_combinations_attributes", "operatingsystem_ids"]})
16
- call(:post, "/api/config_templates", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"config_template"=>["name", "template", "snippet", "audit_comment", "template_kind_id", "template_combinations_attributes", "operatingsystem_ids"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/config_templates", params
35
+ call(:"post", url, params, headers)
17
36
  end
18
37
 
19
- def update(id, params = {}, headers = {})
20
- validate_params!(params, {"config_template"=>["name", "template", "snippet", "audit_comment", "template_kind_id", "template_combinations_attributes", "operatingsystem_ids"]})
21
- call(:put, "/api/config_templates/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "config_template"=>["name", "template", "snippet", "audit_comment", "template_kind_id", "template_combinations_attributes", "operatingsystem_ids"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/config_templates/:id", params
45
+ call(:"put", url, params, headers)
22
46
  end
23
47
 
24
- def revision(params = {}, headers = {})
25
- validate_params!(params, ["version"])
26
- call(:get, "/api/config_templates/revision", :params => params, :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["version"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def revision(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/config_templates/revision", params
55
+ call(:"get", url, params, headers)
27
56
  end
28
57
 
29
- def destroy(id, params = {}, headers = {})
30
- call(:delete, "/api/config_templates/#{id}", :headers => headers)
58
+ # @param [Hash] params a hash of params to be passed to the service
59
+ # allowed keys are: ["id"]
60
+ #
61
+ # @param [Hash] headers additional http headers
62
+ def destroy(params = { }, headers = { })
63
+ check_params params, :allowed => true, :method => __method__
64
+ url, params = fill_params_in_url "/api/config_templates/:id", params
65
+ call(:"delete", url, params, headers)
31
66
  end
32
67
 
33
- def build_pxe_default(params = {}, headers = {})
34
- call(:get, "/api/config_templates/build_pxe_default", :headers => headers)
68
+ # @param [Hash] params a hash of params to be passed to the service
69
+ # allowed keys are: []
70
+ #
71
+ # @param [Hash] headers additional http headers
72
+ def build_pxe_default(params = { }, headers = { })
73
+ check_params params, :allowed => false, :method => __method__
74
+ url, params = fill_params_in_url "/api/config_templates/build_pxe_default", params
75
+ call(:"get", url, params, headers)
35
76
  end
36
77
 
37
78
  end
@@ -1,10 +1,18 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Dashboard < ForemanApi::Base
3
+ class Dashboard < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["dashboard"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search"])
7
- call(:get, "/api/dashboard", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/dashboard", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
18
  end
@@ -1,28 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Domain < ForemanApi::Base
3
+ class Domain < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["domains"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search", "order"])
7
- call(:get, "/api/domains", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/domains", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
- def show(id, params = {}, headers = {})
11
- call(:get, "/api/domains/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/domains/:id", params
25
+ call(:"get", url, params, headers)
12
26
  end
13
27
 
14
- def create(params = {}, headers = {})
15
- validate_params!(params, {"domain"=>["name", "fullname", "dns_id", "domain_parameters_attributes"]})
16
- call(:post, "/api/domains", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"domain"=>["name", "fullname", "dns_id", "domain_parameters_attributes"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/domains", params
35
+ call(:"post", url, params, headers)
17
36
  end
18
37
 
19
- def update(id, params = {}, headers = {})
20
- validate_params!(params, {"domain"=>["name", "fullname", "dns_id", "domain_parameters_attributes"]})
21
- call(:put, "/api/domains/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"domain"=>["name", "fullname", "dns_id", "domain_parameters_attributes"], "id"=>nil}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/domains/:id", params
45
+ call(:"put", url, params, headers)
22
46
  end
23
47
 
24
- def destroy(id, params = {}, headers = {})
25
- call(:delete, "/api/domains/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/domains/:id", params
55
+ call(:"delete", url, params, headers)
26
56
  end
27
57
 
28
58
  end
@@ -1,28 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Environment < ForemanApi::Base
3
+ class Environment < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["environments"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search", "order"])
7
- call(:get, "/api/environments", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/environments", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
- def show(id, params = {}, headers = {})
11
- call(:get, "/api/environments/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/environments/:id", params
25
+ call(:"get", url, params, headers)
12
26
  end
13
27
 
14
- def create(params = {}, headers = {})
15
- validate_params!(params, {"environment"=>["name"]})
16
- call(:post, "/api/environments", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"environment"=>["name"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/environments", params
35
+ call(:"post", url, params, headers)
17
36
  end
18
37
 
19
- def update(id, params = {}, headers = {})
20
- validate_params!(params, {"environment"=>["name"]})
21
- call(:put, "/api/environments/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"environment"=>["name"], "id"=>nil}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/environments/:id", params
45
+ call(:"put", url, params, headers)
22
46
  end
23
47
 
24
- def destroy(id, params = {}, headers = {})
25
- call(:delete, "/api/environments/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/environments/:id", params
55
+ call(:"delete", url, params, headers)
26
56
  end
27
57
 
28
58
  end
@@ -1,13 +1,28 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Home < ForemanApi::Base
3
+ class Home < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["home"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- call(:get, "/api", :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: []
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => false, :method => __method__
14
+ url, params = fill_params_in_url "/api", params
15
+ call(:"get", url, params, headers)
7
16
  end
8
17
 
9
- def status(params = {}, headers = {})
10
- call(:get, "/api/status", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: []
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def status(params = { }, headers = { })
23
+ check_params params, :allowed => false, :method => __method__
24
+ url, params = fill_params_in_url "/api/status", params
25
+ call(:"get", url, params, headers)
11
26
  end
12
27
 
13
28
  end
@@ -1,28 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Medium < ForemanApi::Base
3
+ class Medium < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["media"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search", "order"])
7
- call(:get, "/api/media", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/media", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
- def show(id, params = {}, headers = {})
11
- call(:get, "/api/media/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/media/:id", params
25
+ call(:"get", url, params, headers)
12
26
  end
13
27
 
14
- def create(params = {}, headers = {})
15
- validate_params!(params, {"medium"=>["name", "path", "os_family"]})
16
- call(:post, "/api/medium", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"medium"=>["name", "path", "os_family"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/medium", params
35
+ call(:"post", url, params, headers)
17
36
  end
18
37
 
19
- def update(id, params = {}, headers = {})
20
- validate_params!(params, {"medium"=>["name", "path", "os_family"]})
21
- call(:put, "/api/media/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "medium"=>["name", "path", "os_family"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/media/:id", params
45
+ call(:"put", url, params, headers)
22
46
  end
23
47
 
24
- def destroy(id, params = {}, headers = {})
25
- call(:delete, "/api/media/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/media/:id", params
55
+ call(:"delete", url, params, headers)
26
56
  end
27
57
 
28
58
  end
@@ -1,32 +1,68 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class OperatingSystem < ForemanApi::Base
3
+ class OperatingSystem < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["operatingsystems"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- call(:get, "/api/operatingsystems", :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/operatingsystems", params
15
+ call(:"get", url, params, headers)
7
16
  end
8
17
 
9
- def show(id, params = {}, headers = {})
10
- call(:get, "/api/operatingsystems/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/operatingsystems/:id", params
25
+ call(:"get", url, params, headers)
11
26
  end
12
27
 
13
- def create(params = {}, headers = {})
14
- validate_params!(params, {"operatingsystem"=>["name", "major", "minor"]})
15
- call(:post, "/api/operatingsystems", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"operatingsystem"=>["name", "major", "minor"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/operatingsystems", params
35
+ call(:"post", url, params, headers)
16
36
  end
17
37
 
18
- def update(id, params = {}, headers = {})
19
- validate_params!(params, {"operatingsystem"=>["name", "major", "minor"]})
20
- call(:put, "/api/operatingsystems/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "operatingsystem"=>["name", "major", "minor"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/operatingsystems/:id", params
45
+ call(:"put", url, params, headers)
21
46
  end
22
47
 
23
- def destroy(id, params = {}, headers = {})
24
- call(:delete, "/api/operatingsystems/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/operatingsystems/:id", params
55
+ call(:"delete", url, params, headers)
25
56
  end
26
57
 
27
- def bootfiles(id, params = {}, headers = {})
28
- validate_params!(params, ["medium", "architecture"])
29
- call(:get, "/api/operatingsystems/#{id}/bootfiles", :params => params, :headers => headers)
58
+ # @param [Hash] params a hash of params to be passed to the service
59
+ # allowed keys are: ["id", "medium", "architecture"]
60
+ #
61
+ # @param [Hash] headers additional http headers
62
+ def bootfiles(params = { }, headers = { })
63
+ check_params params, :allowed => true, :method => __method__
64
+ url, params = fill_params_in_url "/api/operatingsystems/:id/bootfiles", params
65
+ call(:"get", url, params, headers)
30
66
  end
31
67
 
32
68
  end
@@ -1,30 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class Subnet < ForemanApi::Base
3
+ class Subnet < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["subnets"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- validate_params!(params, ["search", "order"])
7
- call(:get, "/api/subnets", :params => params, :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/subnets", params
15
+ call(:"get", url, params, headers)
8
16
  end
9
17
 
10
- def create(params = {}, headers = {})
11
- validate_params!(params, {"subnet"=>["name", "network", "mask", "gateway", "dns_primary", "dns_secondary", "from", "to", "vlanid", "domain_ids", "dhcp_id", "tftp_id", "dns_id"]})
12
- call(:post, "/api/subnets", :payload => params, :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: {"subnet"=>["name", "network", "mask", "gateway", "dns_primary", "dns_secondary", "from", "to", "vlanid", "domain_ids", "dhcp_id", "tftp_id", "dns_id"]}
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def create(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/subnets", params
25
+ call(:"post", url, params, headers)
13
26
  end
14
27
 
15
- def update(id, params = {}, headers = {})
16
- validate_params!(params, {"subnet"=>["name", "network", "mask", "gateway", "dns_primary", "dns_secondary", "from", "to", "vlanid", "domain_ids", "dhcp_id", "tftp_id", "dns_id"], "id"=>nil})
17
- call(:put, "/api/subnets/#{id}", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"id"=>nil, "subnet"=>["name", "network", "mask", "gateway", "dns_primary", "dns_secondary", "from", "to", "vlanid", "domain_ids", "dhcp_id", "tftp_id", "dns_id"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def update(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/subnets/:id", params
35
+ call(:"put", url, params, headers)
18
36
  end
19
37
 
20
- def destroy(id, params = {}, headers = {})
21
- validate_params!(params, ["id"])
22
- call(:delete, "/api/subnets/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: ["id"]
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def destroy(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/subnets/:id", params
45
+ call(:"delete", url, params, headers)
23
46
  end
24
47
 
25
- def freeip(params = {}, headers = {})
26
- validate_params!(params, ["subnet_id", "host_mac"])
27
- call(:post, "/api/subnets/freeip", :payload => params, :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["subnet_id", "host_mac"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def freeip(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/subnets/freeip", params
55
+ call(:"post", url, params, headers)
28
56
  end
29
57
 
30
58
  end
@@ -1,27 +1,58 @@
1
1
  module ForemanApi
2
2
  module Resources
3
- class User < ForemanApi::Base
3
+ class User < Apipie::Client::Base
4
+ def self.doc
5
+ @doc ||= ForemanApi.doc['resources']["users"]
6
+ end
4
7
 
5
- def index(params = {}, headers = {})
6
- call(:get, "/api/users", :headers => headers)
8
+ # @param [Hash] params a hash of params to be passed to the service
9
+ # allowed keys are: ["search", "order"]
10
+ #
11
+ # @param [Hash] headers additional http headers
12
+ def index(params = { }, headers = { })
13
+ check_params params, :allowed => true, :method => __method__
14
+ url, params = fill_params_in_url "/api/users", params
15
+ call(:"get", url, params, headers)
7
16
  end
8
17
 
9
- def show(id, params = {}, headers = {})
10
- call(:get, "/api/users/#{id}", :headers => headers)
18
+ # @param [Hash] params a hash of params to be passed to the service
19
+ # allowed keys are: ["id"]
20
+ #
21
+ # @param [Hash] headers additional http headers
22
+ def show(params = { }, headers = { })
23
+ check_params params, :allowed => true, :method => __method__
24
+ url, params = fill_params_in_url "/api/users/:id", params
25
+ call(:"get", url, params, headers)
11
26
  end
12
27
 
13
- def create(params = {}, headers = {})
14
- validate_params!(params, {"user"=>["login", "firstname", "lastname", "mail", "admin"]})
15
- call(:post, "/api/users", :payload => params, :headers => headers)
28
+ # @param [Hash] params a hash of params to be passed to the service
29
+ # allowed keys are: {"user"=>["login", "firstname", "lastname", "mail", "admin", "password", "auth_source_id"]}
30
+ #
31
+ # @param [Hash] headers additional http headers
32
+ def create(params = { }, headers = { })
33
+ check_params params, :allowed => true, :method => __method__
34
+ url, params = fill_params_in_url "/api/users", params
35
+ call(:"post", url, params, headers)
16
36
  end
17
37
 
18
- def update(id, params = {}, headers = {})
19
- validate_params!(params, {"user"=>["login", "firstname", "lastname", "mail", "admin"]})
20
- call(:put, "/api/users/#{id}", :payload => params, :headers => headers)
38
+ # @param [Hash] params a hash of params to be passed to the service
39
+ # allowed keys are: {"id"=>nil, "user"=>["login", "firstname", "lastname", "mail", "admin", "password"]}
40
+ #
41
+ # @param [Hash] headers additional http headers
42
+ def update(params = { }, headers = { })
43
+ check_params params, :allowed => true, :method => __method__
44
+ url, params = fill_params_in_url "/api/users/:id", params
45
+ call(:"put", url, params, headers)
21
46
  end
22
47
 
23
- def destroy(id, params = {}, headers = {})
24
- call(:delete, "/api/users/#{id}", :headers => headers)
48
+ # @param [Hash] params a hash of params to be passed to the service
49
+ # allowed keys are: ["id"]
50
+ #
51
+ # @param [Hash] headers additional http headers
52
+ def destroy(params = { }, headers = { })
53
+ check_params params, :allowed => true, :method => __method__
54
+ url, params = fill_params_in_url "/api/users/:id", params
55
+ call(:"delete", url, params, headers)
25
56
  end
26
57
 
27
58
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanApi
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/foreman_api.rb CHANGED
@@ -1,13 +1,27 @@
1
- require 'foreman_api/base'
2
- require 'foreman_api/version'
3
-
4
- resource_files = Dir[File.expand_path('../foreman_api/resources/*.rb', __FILE__)]
5
- resource_files.each { |f| require f }
1
+ require 'apipie/client/base'
2
+ require 'json'
3
+ require 'yaml'
6
4
 
7
- module ForemanApi
5
+ Object.const_set("ForemanApi", client_module = Module.new do
8
6
  def self.client_config
9
- @client_config ||= { :base_url => "http://localhost:3000",
10
- :oauth => { :consumer_key => 'consumer',
11
- :consumer_secret => 'shhhh' } }
7
+ @client_config ||= YAML.load_file("#{root}/#{name}/config.yml")
8
+ end
9
+
10
+ def self.root
11
+ @root ||= File.expand_path(File.dirname(__FILE__))
12
+ end
13
+
14
+ def self.name
15
+ "foreman_api"
16
+ end
17
+
18
+ def self.doc
19
+ @doc ||= File.open("#{root}/#{name}/documentation.json", 'r') do |f|
20
+ JSON.load(f.read)['docs']
21
+ end
12
22
  end
13
- end
23
+ end)
24
+
25
+ require 'foreman_api/version'
26
+ resource_files = Dir[File.expand_path("#{client_module.root}/#{client_module.name}/resources/*.rb", __FILE__)]
27
+ resource_files.each { |f| require f }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Martin Ba\xC4\x8Dovsk\xC3\xBD"
@@ -15,12 +15,28 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-11 00:00:00 Z
18
+ date: 2012-10-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: json
21
+ name: apipie-rails
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 0
31
+ - 0
32
+ - 12
33
+ version: 0.0.12
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
24
40
  none: false
25
41
  requirements:
26
42
  - - ">="
@@ -30,11 +46,11 @@ dependencies:
30
46
  - 0
31
47
  version: "0"
32
48
  type: :runtime
33
- version_requirements: *id001
49
+ version_requirements: *id002
34
50
  - !ruby/object:Gem::Dependency
35
51
  name: rest-client
36
52
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
38
54
  none: false
39
55
  requirements:
40
56
  - - ">="
@@ -46,11 +62,11 @@ dependencies:
46
62
  - 1
47
63
  version: 1.6.1
48
64
  type: :runtime
49
- version_requirements: *id002
65
+ version_requirements: *id003
50
66
  - !ruby/object:Gem::Dependency
51
67
  name: oauth
52
68
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
69
+ requirement: &id004 !ruby/object:Gem::Requirement
54
70
  none: false
55
71
  requirements:
56
72
  - - ">="
@@ -60,7 +76,7 @@ dependencies:
60
76
  - 0
61
77
  version: "0"
62
78
  type: :runtime
63
- version_requirements: *id003
79
+ version_requirements: *id004
64
80
  description: Helps you to use Foreman's API calls from your app
65
81
  email:
66
82
  - mbacovsk@redhat.com
@@ -77,7 +93,8 @@ files:
77
93
  - Rakefile
78
94
  - foreman_api.gemspec
79
95
  - lib/foreman_api.rb
80
- - lib/foreman_api/base.rb
96
+ - lib/foreman_api/config.yml
97
+ - lib/foreman_api/documentation.json
81
98
  - lib/foreman_api/resources/architecture.rb
82
99
  - lib/foreman_api/resources/bookmark.rb
83
100
  - lib/foreman_api/resources/config_template.rb
@@ -89,7 +106,6 @@ files:
89
106
  - lib/foreman_api/resources/operating_system.rb
90
107
  - lib/foreman_api/resources/subnet.rb
91
108
  - lib/foreman_api/resources/user.rb
92
- - lib/foreman_api/rest_client_oauth.rb
93
109
  - lib/foreman_api/version.rb
94
110
  homepage: http://github.com/mbacovsky/foreman_api
95
111
  licenses: []
@@ -1,55 +0,0 @@
1
- require 'rest_client'
2
- require 'oauth'
3
- require 'json'
4
- require 'foreman_api/rest_client_oauth'
5
-
6
- module ForemanApi
7
- class Base
8
- attr_reader :client
9
-
10
- def initialize(config = ForemanApi.client_config, options = { })
11
- @client = RestClient::Resource.new config[:base_url],
12
- :user => config[:username],
13
- :password => config[:password],
14
- :oauth => config[:oauth],
15
- :headers => { :content_type => 'application/json',
16
- :accept => 'application/json' }
17
- end
18
-
19
- def call(method, path, options = { })
20
- payload, headers, params = options.values_at :payload, :headers, :params
21
- headers[:params] = params if params
22
-
23
- args = [method]
24
- args << payload.to_json if [:post, :put].include?(method)
25
- args << headers if headers
26
- process_data client[path].send(*args)
27
- end
28
-
29
- def validate_params!(options, valid_keys)
30
- return unless options.is_a?(Hash)
31
- invalid_keys = options.keys.map(&:to_s) - (valid_keys.is_a?(Hash) ? valid_keys.keys : valid_keys)
32
- raise ArgumentError, "Invalid keys: #{invalid_keys.join(", ")}" unless invalid_keys.empty?
33
-
34
- if valid_keys.is_a? Hash
35
- valid_keys.each do |key, keys|
36
- if options[key]
37
- validate_params!(options[key], keys)
38
- end
39
- end
40
- end
41
- end
42
-
43
- protected
44
-
45
- def process_data(response)
46
- data = begin
47
- JSON.parse(response.body)
48
- rescue JSON::ParserError
49
- response.body
50
- end
51
- return data, response
52
- end
53
-
54
- end
55
- end
@@ -1,29 +0,0 @@
1
- unless RestClient.const_defined? :OAUTH_EXTENSION
2
- RestClient::OAUTH_EXTENSION = lambda do |request, args|
3
- if args[:oauth]
4
- uri = URI.parse args[:url]
5
- default_options = { :site => "#{uri.scheme}://#{uri.host}:#{uri.port.to_s}",
6
- :request_token_path => "",
7
- :authorize_path => "",
8
- :access_token_path => "" }
9
- options = default_options.merge args[:oauth][:options] || { }
10
- consumer = OAuth::Consumer.new(args[:oauth][:consumer_key], args[:oauth][:consumer_secret], options)
11
-
12
-
13
- method_to_http_request = { :get => Net::HTTP::Get,
14
- :post => Net::HTTP::Post,
15
- :put => Net::HTTP::Put,
16
- :delete => Net::HTTP::Delete }
17
-
18
- http_request = method_to_http_request[args[:method]].
19
- new(args[:url]) # create Net::HTTPRequest to get oauth header,
20
- # because RestClient::Request is not supported by Oauth
21
- consumer.sign!(http_request)
22
- request['Authorization'] = http_request['Authorization'] # add oauth header to rest_client request
23
- end
24
- end
25
- end
26
-
27
- unless RestClient.before_execution_procs.include? RestClient::OAUTH_EXTENSION
28
- RestClient.add_before_execution_proc &RestClient::OAUTH_EXTENSION
29
- end