reve 0.0.76 → 0.0.77

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.
@@ -4,17 +4,8 @@ module Reve #:nodoc:
4
4
  # All of these are shamelessly nicked from Ruby on Rails.
5
5
  # The String Extensions have a bit more fault tolerance.
6
6
  module Extensions
7
-
7
+
8
8
  module NilClass
9
- def to_s
10
- self
11
- end
12
- def to_i
13
- self
14
- end
15
- def to_f
16
- self
17
- end
18
9
  def to_date
19
10
  self
20
11
  end
@@ -96,60 +87,26 @@ module Reve #:nodoc:
96
87
  self
97
88
  end
98
89
  end
99
-
100
- # Try to make an Integer from a string. Will make sure that there's
101
- # actually an integer there. "ponies".to_i will return "ponies" since it
102
- # isn't an Integer. Yeah, probably not the best way but I do this with
103
- # to_time and to_date. Deal with it - at least it doesn't raise an
104
- # Exception.
105
- def to_i
106
- begin
107
- Integer(self).to_s == self ? Integer(self) : self
108
- rescue ArgumentError
109
- self
110
- end
111
- end
112
- def to_date
113
- begin
114
- ::Date.new(*ParseDate.parsedate(self)[0..2])
115
- rescue TypeError,ArgumentError
116
- self
117
- end
118
- end
119
- end
120
- module Time
121
- def to_date
122
- ::Date.new(year,month,day)
123
- end
124
- def to_time
125
- self
126
- end
127
- end
128
- module Date
129
- def to_date
130
- self
131
- end
132
- def to_time(form = :utc)
133
- if respond_to?(:hour)
134
- ::Time.send(form,year,month,day,hour,min,sec)
135
- else
136
- ::Time.send(form, year, month, day)
137
- end
138
- end
139
90
  end
140
91
  end
141
92
  end
142
93
 
143
94
  class String #:nodoc:
144
95
  include Reve::Extensions::String
145
- end
146
-
147
- class Time #:nodoc:
148
- include Reve::Extensions::Time
149
- end
150
-
151
- class Date #:nodoc:
152
- include Reve::Extensions::Date
96
+
97
+ # Try to make an Integer from a string. Will make sure that there's
98
+ # actually an integer there. "ponies".to_i will return "ponies" since it
99
+ # isn't an Integer. Yeah, probably not the best way but I do this with
100
+ # to_time and to_date. Deal with it - at least it doesn't raise an
101
+ # Exception.
102
+ # (Have to redefine this method as it already exists in base String class)
103
+ def to_i
104
+ begin
105
+ Integer(self).to_s == self ? Integer(self) : self
106
+ rescue ArgumentError
107
+ self
108
+ end
109
+ end
153
110
  end
154
111
 
155
112
  class Class #:nodoc:
data/lib/reve.rb CHANGED
@@ -22,9 +22,9 @@ require 'fileutils'
22
22
 
23
23
  $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
24
24
 
25
- require 'lib/reve/exceptions'
26
- require 'lib/reve/extensions'
27
- require 'lib/reve/classes'
25
+ require 'reve/exceptions'
26
+ require 'reve/extensions'
27
+ require 'reve/classes'
28
28
 
29
29
 
30
30
  module Reve
data/test/test_reve.rb CHANGED
@@ -1,3 +1,19 @@
1
+ =begin
2
+ TODO: Test:
3
+ * market orders with closed, pending and character deleted status
4
+ * errors
5
+ * corporate_market_orders
6
+ * corporate_wallet_balance
7
+ * corporate_wallet_transactions
8
+ * corporate_wallet_journal
9
+ * corporate_assets_list
10
+ * personal_kills (with contained losses)
11
+ * corporate_kills
12
+ * character_sheet with a generic AttributeEnhancer (or remove the option and raise an exception)
13
+ * test get_xml when a nil object is passed to test ReveNetworkStatusException
14
+ * check check_xml to try and provoke a failure in the search
15
+ =end
16
+
1
17
  require 'test/unit'
2
18
  require 'reve'
3
19
  require 'fileutils' # for saving downloaded XML
@@ -678,18 +694,6 @@ class TestReve < Test::Unit::TestCase
678
694
  assert_equal real,time
679
695
  end
680
696
 
681
- def test_to_date_method
682
- str = "2008-01-23"
683
- real = Date.civil(2008,01,23)
684
- date = nil
685
- assert_nothing_raised do
686
- date = str.to_date
687
- end
688
- assert_kind_of Date,date
689
- assert_equal real,date
690
- end
691
-
692
-
693
697
  protected
694
698
  def get_api(userid = nil, apikey = nil, charid = nil)
695
699
  api = Reve::API.new(userid, apikey, charid)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: reve
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.76
7
- date: 2008-02-02 00:00:00 +00:00
6
+ version: 0.0.77
7
+ date: 2008-02-03 00:00:00 +00:00
8
8
  summary: Reve is a Ruby library to interface with the Eve Online API
9
9
  require_paths:
10
10
  - lib