class Orchestrate::API::Request
Uses HTTParty to make the HTTP calls, and returns a Response object.
Attributes
          data[RW]
        
        The json document for creating or updating a key.
          method[RW]
        
        The HTTP method - must be one of: [ :get, :put, :delete ].
          ref[RW]
        
        The ref value associated with a key.
          url[RW]
        
        The url for the HTTP request.
          user[RW]
        
        The api key for HTTP Basic Authentication over SSL.
          verbose[RW]
        
        Boolean
Public Class Methods
          new(method, url, user) { |self| ... }
          
          click to toggle source
          
        
        
        Sets the universal attributes from the params; any additional attributes are set from the block.
# File api/lib/orchestrate_api/request.rb, line 31 def initialize(method, url, user) @method, @url, @user = method, url, user @data = {} yield self if block_given? end
Public Instance Methods
          perform()
          
          click to toggle source
          
        
        
        Sends the HTTP request and returns a Response object.
# File api/lib/orchestrate_api/request.rb, line 38 def perform puts "\n------- #{method.to_s.upcase} \"#{url}\" ------" if verbose? Response.new HTTParty.send(method, url, options) end
Private Instance Methods
          options()
          
          click to toggle source
          
        
        
        Sets up the HTTParty options hash.
# File api/lib/orchestrate_api/request.rb, line 46 def options options = { basic_auth: { username: user, password: nil }} if method == :put headers = { 'Content-Type' => 'application/json' } if ref header = ref == '"*"' ? 'If-None-Match' : 'If-Match' headers.merge!(header => ref) end options.merge!(headers: headers, body: data) end options end
          verbose?()
          
          click to toggle source
          
        
        
        # File api/lib/orchestrate_api/request.rb, line 59 def verbose? verbose == true end