chdorner-gdocsapi-wrapper 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{gdocsapi-wrapper}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Christof Dorner"]
@@ -26,7 +26,8 @@ require 'gdocsapi-wrapper/base'
26
26
  require 'gdocsapi-wrapper/http'
27
27
  require 'gdocsapi-wrapper/auth'
28
28
  require 'gdocsapi-wrapper/client'
29
+ require 'gdocsapi-wrapper/models'
29
30
 
30
31
  module GDocsAPIWrapper
31
- VERSION = '0.0.2'
32
+ VERSION = '0.0.3'
32
33
  end
@@ -38,4 +38,7 @@ module GDocsAPIWrapper
38
38
  class AuthorizationError < RequestError
39
39
  end
40
40
 
41
+ class LoginRequiredError < Error
42
+ end
43
+
41
44
  end
@@ -19,29 +19,5 @@
19
19
  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
20
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- module GDocsAPIWrapper
23
- class Client
24
-
25
- # Identifying the application which uses the GDocsAPIWrapper
26
- attr_accessor :source
27
- attr_accessor :login_handler
28
-
29
- def initialize(options = {})
30
- options.each do |key, value|
31
- self.send("#{key}=", value)
32
- end
33
-
34
- @source ||= 'UndefinedApplication'
35
- end
36
-
37
- # Performs login on GDocsAPIWrapper:Auth
38
- def login(username, password)
39
- source = GDocsAPIWrapper::Auth::SOURCE_PREFIX + @source
40
-
41
- @login_handler = GDocsAPIWrapper::Auth::Login.new
42
- @login_handler.perform_login(username, password, source)
43
-
44
- puts 'Token: ' + @login_handler.token
45
- end
46
- end
47
- end
22
+ require 'gdocsapi-wrapper/client/client'
23
+ require 'gdocsapi-wrapper/client/service'
@@ -29,6 +29,7 @@ module GDocsAPIWrapper
29
29
  attr_accessor :url
30
30
  attr_accessor :body
31
31
  attr_accessor :method
32
+ attr_accessor :headers
32
33
 
33
34
  def initialize(url, options = {})
34
35
  @url = url
@@ -37,6 +38,7 @@ module GDocsAPIWrapper
37
38
  end
38
39
 
39
40
  @method ||= :get
41
+ @headers ||= {}
40
42
  end
41
43
 
42
44
  def send_request
@@ -69,7 +71,11 @@ module GDocsAPIWrapper
69
71
  else
70
72
  req.body = @body.to_s
71
73
  end
72
- #request.calculate_length!
74
+
75
+ @headers.each do |key, value|
76
+ req[key] = value
77
+ end
78
+ req['GData-Version'] ||= '2.0'
73
79
 
74
80
  res = http.request(req)
75
81
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chdorner-gdocsapi-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christof Dorner