Class: GData4Ruby::Base
- Inherits:
-
Object
- Object
- GData4Ruby::Base
- Defined in:
- lib/gdata4ruby/base.rb
Overview
The Base class includes the basic HTTP methods for communicating with the Google Data API. You shouldn’t use this class directly, rather access the functionality through the Service subclass.
Direct Known Subclasses
Constant Summary collapse
- AUTH_URL =
"https://www.google.com/accounts/ClientLogin"
Instance Attribute Summary collapse
-
#debug ⇒ Object
If set to true, debug will dump all raw HTTP requests and responses.
-
#gdata_version ⇒ Object
The GData version used by the service.
-
#proxy_info ⇒ Object
Contains the ProxyInfo object for using a proxy server.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
Optionally, pass a hash of attributes to populate the class.
-
#send_request(request) ⇒ Object
Sends a request to the Google Data System.
Constructor Details
#initialize(attributes = {}) ⇒ Base
Optionally, pass a hash of attributes to populate the class. If you want to use a GData version other than the default (2.1), pass a key/value pair, i.e. => ‘1.0’
85 86 87 |
# File 'lib/gdata4ruby/base.rb', line 85 def initialize(attributes = {}) @gdata_version = attributes[:gdata_version] ? attributes[:gdata_version] : '2.1' end |
Instance Attribute Details
#debug ⇒ Object
If set to true, debug will dump all raw HTTP requests and responses
78 79 80 |
# File 'lib/gdata4ruby/base.rb', line 78 def debug @debug end |
#gdata_version ⇒ Object
The GData version used by the service
81 82 83 |
# File 'lib/gdata4ruby/base.rb', line 81 def gdata_version @gdata_version end |
#proxy_info ⇒ Object
Contains the ProxyInfo object for using a proxy server
75 76 77 |
# File 'lib/gdata4ruby/base.rb', line 75 def proxy_info @proxy_info end |
Instance Method Details
#send_request(request) ⇒ Object
Sends a request to the Google Data System. Accepts a valid Request object, and returns a HTTPResult class.
91 92 93 94 95 |
# File 'lib/gdata4ruby/base.rb', line 91 def send_request(request) raise ArgumentError 'Request must be a GData4Ruby::Request object' if not request.is_a?Request puts "sending #{request.type} to url = #{request.url.to_s}" if @debug do_request(request) end |