aproxacs-storyq_client 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,14 +1,18 @@
1
- == 0.0.3 2008-07-09
1
+ == 0.1.0 2008-07-31
2
+ * git test
2
3
 
4
+ == 0.0.4 2008-07-29
5
+ * 1 tiny enhancement
6
+ * Handles 401 Unauthorized requests
7
+
8
+ == 0.0.3 2008-07-09
3
9
  * 1 tiny enhancement
4
10
  * mis-typing
5
11
 
6
12
  == 0.0.2 2008-07-09
7
-
8
13
  * 1 tiny enhancement
9
14
  * mis-typing
10
15
 
11
16
  == 0.0.1 2008-07-09
12
-
13
17
  * 1 major enhancement:
14
18
  * Initial release
data/README.txt CHANGED
@@ -87,13 +87,13 @@ photo.destory
87
87
 
88
88
  == INSTALL:
89
89
 
90
- * sudo gem install storyq_client
90
+ * sudo gem install aproxacs-storyq_client
91
91
 
92
92
  == LICENSE:
93
93
 
94
94
  (The MIT License)
95
95
 
96
- Copyright (c) 2008 Bryan Kang
96
+ Copyright (c) 2008 chang
97
97
 
98
98
  Permission is hereby granted, free of charge, to any person obtaining
99
99
  a copy of this software and associated documentation files (the
@@ -29,17 +29,25 @@ module Storyq
29
29
 
30
30
  def post url, body, headers={}
31
31
  headers["content-type"] ||= 'application/x-www-form-urlencoded' unless body.blank?
32
- access_token.request(:post, url, body, header(headers)).body
32
+ handle_response access_token.request(:post, url, body, header(headers))
33
33
  end
34
34
  def put url, body, headers={}
35
35
  headers["content-type"] ||= 'application/x-www-form-urlencoded' unless body.blank?
36
- access_token.request(:put, url, body, header(headers)).body
36
+ handle_response access_token.request(:put, url, body, header(headers))
37
37
  end
38
38
  def delete url, headers={}
39
- access_token.request(:delete, url, header(headers)).body
39
+ handle_response access_token.request(:delete, url, header(headers))
40
40
  end
41
41
  def get url, headers={}
42
- access_token.request(:get, url, header(headers)).body
42
+ handle_response access_token.request(:get, url, header(headers))
43
+ end
44
+
45
+ def handle_response(response)
46
+ if response.code=="200"
47
+ response.body
48
+ else
49
+ response.error!
50
+ end
43
51
  end
44
52
 
45
53
  def header headers
@@ -1,5 +1,6 @@
1
1
  module Storyq
2
2
  module Token
3
+ class AccessTokenNotExist < StandardError; end
3
4
  def access_token
4
5
  @access_token ||= create_access_token
5
6
  end
@@ -16,7 +17,7 @@ module Storyq
16
17
  if access_key and access_secret
17
18
  OAuth::AccessToken.new consumer, access_key, access_secret
18
19
  else
19
- authorize
20
+ raise AccessTokenNotExist
20
21
  end
21
22
  end
22
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aproxacs-storyq_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aproxacs
@@ -30,7 +30,7 @@ dependencies:
30
30
  - !ruby/object:Gem::Version
31
31
  version: 0.2.4
32
32
  version:
33
- description: This library makes it easy to use storyq's Open API. You can easily upload documents and photos to the storyq and convert them to the flash slide with this library. This follows the restful style but not use active_resource.
33
+ description: This library makes it easy to use storyq's Open API. You can easily upload documents and photos to the storyq and convert them to the flash slide with this library. This follows the restful style but not use active_resource.
34
34
  email: aproxacs@gmail.com
35
35
  executables: []
36
36