eventfulapi 2.1 → 2.1.1

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.
Files changed (2) hide show
  1. data/lib/eventful/api.rb +27 -21
  2. metadata +2 -2
@@ -5,7 +5,7 @@
5
5
  # See http://api.eventful.com for more information about the Eventful API and
6
6
  # the available API methods.
7
7
  #
8
- # = Example Usage
8
+ # == Example Usage
9
9
  #
10
10
  # require 'rubygems'
11
11
  # require 'eventful/api'
@@ -34,15 +34,21 @@
34
34
  # end
35
35
  #
36
36
  #
37
- # = API Key
37
+ # == API Key
38
38
  #
39
- # Use of the Eventful API requires an application key (see http://api.eventful.com/keys for more information).
39
+ # Use of the Eventful API requires an application key
40
+ # (see http://api.eventful.com/keys for more information).
40
41
  #
41
- # = Change Notes
42
+ # == Change Notes
42
43
  #
43
- # == Eventful API
44
+ # === Eventful API
44
45
  #
45
- # === Version 2.1
46
+ # ==== Version 2.1.1
47
+ #
48
+ # - Includes a workaround fix for an authentication bug. This fix may be rolled
49
+ # back should the workaround become unecessary in the future.
50
+ #
51
+ # ==== Version 2.1
46
52
  #
47
53
  # - As EVDB Inc. has been renamed Eventful Inc., the EVDB module has been
48
54
  # renamed Eventful, and the gem is now named eventfulapi. Support for the
@@ -51,13 +57,13 @@
51
57
  # rather than failing silently and mysteriously
52
58
  # - Documentation improvements
53
59
  #
54
- # == EVDB API
60
+ # === EVDB API
55
61
  #
56
- # === Version 2.0.1
62
+ # ==== Version 2.0.1
57
63
  #
58
64
  # - Fixed a minor documentation error
59
65
  #
60
- # === Version 2.0
66
+ # ==== Version 2.0
61
67
  #
62
68
  # Version 2.0 of this library includes some significant changes which may not
63
69
  # be backwards compatible. Specifically:
@@ -69,10 +75,10 @@
69
75
  # XML, and the objects returned from a call can be used like hashes instead of
70
76
  # REXML objects.
71
77
  #
72
- # = Information
78
+ # == Information
73
79
  #
74
80
  # Status:: Stable
75
- # Version:: 2.1
81
+ # Version:: 2.1.1
76
82
  # Date:: 2007-03-24
77
83
  # Current Author:: Paul Knight (mailto:pknight@eventful.com)
78
84
  # Previous Authors:: Joe Auricchio
@@ -98,7 +104,8 @@ require 'cgi'
98
104
  require 'net/http'
99
105
  require 'base64'
100
106
  require 'digest/md5'
101
-
107
+ require 'open-uri'
108
+ require 'rexml/document'
102
109
 
103
110
 
104
111
 
@@ -157,7 +164,6 @@ module Eventful
157
164
  #
158
165
  # <tt>'user'</tt>:: Authenticate as this user, required for some API methods. A password must also be specified.
159
166
  # <tt>'password'</tt>:: Password for user authentication.
160
- # <tt>'api_server'</tt>, <tt>'api_root'</tt>, <tt>'api_port'</tt>:: For specifying a different API server.
161
167
  #
162
168
  # Example:
163
169
  #
@@ -177,14 +183,7 @@ module Eventful
177
183
 
178
184
  # User authentication
179
185
  if (options['user'] && options['password'])
180
- # Get a nonce; we expect an error response here, so rescue the exception and continue
181
- begin
182
- response = call 'users/login',
183
- 'app_key' => app_key
184
- rescue APIError => err
185
- raise if !err.response['nonce']
186
- nonce = err.response['nonce']
187
- end
186
+ nonce = get_nonce app_key
188
187
 
189
188
  # Login with a hash of the nonce and our password
190
189
  login_hash = Digest::MD5.hexdigest("#{nonce}:#{Digest::MD5.hexdigest(options['password'])}")
@@ -264,6 +263,13 @@ module Eventful
264
263
  return yaml
265
264
  end
266
265
 
266
+ # Only intended for the first users/login authentication call
267
+ def get_nonce(app_key) # :nodoc:
268
+ open "http://#{@api_server}/rest/users/login?app_key=#{CGI::escape app_key}" do |f|
269
+ (REXML::Document.new f.read).elements["error/nonce"].text
270
+ end
271
+ end
272
+
267
273
 
268
274
 
269
275
  end # class API
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: eventfulapi
5
5
  version: !ruby/object:Gem::Version
6
- version: "2.1"
7
- date: 2007-03-26 00:00:00 -07:00
6
+ version: 2.1.1
7
+ date: 2007-04-24 00:00:00 -07:00
8
8
  summary: Interface to the Eventful API. http://eventful.com
9
9
  require_paths:
10
10
  - lib