Class: GoogleApps::AppsRequest
- Inherits:
-
Object
- Object
- GoogleApps::AppsRequest
- Defined in:
- lib/google_apps/apps_request.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#add_body(content) ⇒ Object
add_body sets the body the provided content.
-
#initialize(verb, uri, headers) ⇒ AppsRequest
constructor
A new instance of AppsRequest.
-
#send_request ⇒ Object
send_request does the actual work of sending @http_request as it is currently constructed.
Constructor Details
#initialize(verb, uri, headers) ⇒ AppsRequest
Returns a new instance of AppsRequest.
7 8 9 10 11 12 13 |
# File 'lib/google_apps/apps_request.rb', line 7 def initialize(verb, uri, headers) @uri = URI uri @ssl = (@uri.scheme == 'https') @http_request = initialize_http(verb) set_headers(headers) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
5 6 7 |
# File 'lib/google_apps/apps_request.rb', line 5 def uri @uri end |
Instance Method Details
#add_body(content) ⇒ Object
add_body sets the body the provided content.
add_body ‘bob’
add_body returns the content added.
34 35 36 |
# File 'lib/google_apps/apps_request.rb', line 34 def add_body(content) @http_request.body = content end |
#send_request ⇒ Object
send_request does the actual work of sending @http_request as it is currently constructed.
send_request
send_request returns a Net::HTTPResponse object.
22 23 24 25 26 |
# File 'lib/google_apps/apps_request.rb', line 22 def send_request Net::HTTP.start(@uri.host, @uri.port, use_ssl: @ssl) do |http| http.request(@http_request) end end |