Class: Spice::Connection
- Inherits:
-
Object
- Object
- Spice::Connection
- Includes:
- Authentication, Clients, Cookbooks, DataBags, Environments, Nodes, Roles, Search, Request, Toy::Store
- Defined in:
- lib/spice/connection.rb,
lib/spice/connection/nodes.rb,
lib/spice/connection/roles.rb,
lib/spice/connection/search.rb,
lib/spice/connection/clients.rb,
lib/spice/connection/cookbooks.rb,
lib/spice/connection/data_bags.rb,
lib/spice/connection/environments.rb,
lib/spice/connection/authentication.rb
Defined Under Namespace
Modules: Authentication, Clients, Cookbooks, DataBags, Environments, Nodes, Roles, Search
Instance Attribute Summary (collapse)
-
- (String) client_name
The client_name attribute.
-
- (String) endpoint
The endpoint attribute.
-
- (String) key
The key attribute.
-
- (String) key_file
The key_file attribute.
-
- (String) server_url
The server_url attribute.
-
- (Boolean) sign_on_redirect
The sign_on_redirect attribute.
-
- (Boolean) sign_request
The sign_request attribute.
Instance Method Summary (collapse)
- - (Object) connection
-
- (Faraday::Response) delete(path)
Perform an HTTP DELETE request.
-
- (Faraday::Response) get(path)
Perform an HTTP GET request.
- - (Object) parsed_url
-
- (Faraday::Response) post(path, payload)
Perform an HTTP POST request.
-
- (Faraday::Response) put(path, payload)
Perform an HTTP PUT request.
Methods included from Request
Methods included from Authentication
#sign_requests?, #signature_headers
Methods included from Search
Methods included from Roles
Methods included from Nodes
Methods included from Environments
Methods included from DataBags
#data_bag, #data_bag_item, #data_bags
Methods included from Cookbooks
#cookbook, #cookbook_version, #cookbooks
Methods included from Clients
Instance Attribute Details
- (String) client_name
The client_name attribute
36 |
# File 'lib/spice/connection.rb', line 36 attribute :client_name, String |
- (String) endpoint
The endpoint attribute
42 |
# File 'lib/spice/connection.rb', line 42 attribute :endpoint, String |
- (String) key
The key attribute
38 |
# File 'lib/spice/connection.rb', line 38 attribute :key, String |
- (String) key_file
The key_file attribute
37 |
# File 'lib/spice/connection.rb', line 37 attribute :key_file, String |
- (String) server_url
The server_url attribute
39 |
# File 'lib/spice/connection.rb', line 39 attribute :server_url, String |
- (Boolean) sign_on_redirect
The sign_on_redirect attribute
40 |
# File 'lib/spice/connection.rb', line 40 attribute :sign_on_redirect, Boolean, :default => true |
- (Boolean) sign_request
The sign_request attribute
41 |
# File 'lib/spice/connection.rb', line 41 attribute :sign_request, Boolean, :default => true |
Instance Method Details
- (Object) connection
46 47 48 |
# File 'lib/spice/connection.rb', line 46 def connection self end |
- (Faraday::Response) delete(path)
Perform an HTTP DELETE request
110 111 112 113 114 115 116 117 118 |
# File 'lib/spice/connection.rb', line 110 def delete(path) response = request(:headers => build_headers( :DELETE, "#{parsed_url.path}#{path}") ).delete( "#{server_url}#{path}" ) return response end |
- (Faraday::Response) get(path)
Perform an HTTP GET request
59 60 61 62 63 64 65 66 67 |
# File 'lib/spice/connection.rb', line 59 def get(path) response = request(:headers => build_headers( :GET, "#{parsed_url.path}#{path}") ).get( "#{server_url}#{path}" ) return response end |
- (Object) parsed_url
50 51 52 |
# File 'lib/spice/connection.rb', line 50 def parsed_url URI.parse(server_url) end |
- (Faraday::Response) post(path, payload)
Perform an HTTP POST request
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/spice/connection.rb', line 75 def post(path, payload) response = request(:headers => build_headers( :POST, "#{parsed_url.path}#{path}", Yajl.dump(payload)) ).post( "#{server_url}#{path}", Yajl.dump(payload) ) return response end |
- (Faraday::Response) put(path, payload)
Perform an HTTP PUT request
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/spice/connection.rb', line 93 def put(path, payload) response = request(:headers => build_headers( :PUT, "#{parsed_url.path}#{path}", Yajl.dump(payload)) ).put( "#{server_url}#{path}", Yajl.dump(payload) ) return response end |