tedkulp-freshbooks.rb 3.0.23 → 3.0.24
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.
- data/README +16 -1
- data/Rakefile +1 -1
- data/lib/freshbooks.rb +2 -1
- data/lib/freshbooks/base.rb +6 -3
- data/lib/freshbooks/schema/definition.rb +2 -2
- data/test/test_base.rb +24 -0
- metadata +17 -4
data/README
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
= Todo
|
2
|
+
|
3
|
+
Please send me a message if you are interested in contributing. Here is a quick overview of some things I'd like to add to the gem.
|
4
|
+
|
5
|
+
Merge in forked versions of this gem (any idea what forks are worth while?)
|
6
|
+
Provide a way to retrieve the error message with actions beside list are called.
|
7
|
+
Make ListProxy optional on list actions. Some people have valid reason to deal with pagination.
|
8
|
+
Add oAuth
|
9
|
+
Add webhooks
|
10
|
+
More tests including integration tests
|
11
|
+
Write some documentation and examples
|
12
|
+
Launch an official 3.0 (maybe call it 4.0) version of the gem
|
13
|
+
Post the official version to rubygems
|
14
|
+
Ensure rubygems aren't required for this gem.
|
15
|
+
|
1
16
|
= About
|
2
17
|
|
3
18
|
FreshBooks.rb is a Ruby interface to the FreshBooks API. It exposes easy-to-use classes and methods for interacting with your FreshBooks account.
|
@@ -35,7 +50,7 @@ This work is distributed under the MIT License. Use/modify the code however you
|
|
35
50
|
|
36
51
|
= Download
|
37
52
|
|
38
|
-
sudo gem install
|
53
|
+
sudo gem install bcurren-freshbooks.rb
|
39
54
|
|
40
55
|
= Credits
|
41
56
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ $hoe = Hoe.spec('freshbooks.rb') do |p|
|
|
8
8
|
p.summary = ''
|
9
9
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
10
10
|
p.rubyforge_name = p.name # TODO this is default value
|
11
|
-
p.extra_deps = [ ['activesupport', '>= 0'] ]
|
11
|
+
p.extra_deps = [ ['activesupport', '>= 3.0.0'] ]
|
12
12
|
p.extra_dev_deps = [
|
13
13
|
['newgem', ">= #{::Newgem::VERSION}"],
|
14
14
|
['mocha', ">= 0.9.4"]
|
data/lib/freshbooks.rb
CHANGED
@@ -8,6 +8,7 @@ rescue LoadError
|
|
8
8
|
gem 'activesupport'
|
9
9
|
require 'active_support'
|
10
10
|
end
|
11
|
+
require 'active_support/all'
|
11
12
|
|
12
13
|
require 'freshbooks/base'
|
13
14
|
require 'freshbooks/category'
|
@@ -60,7 +61,7 @@ require 'logger'
|
|
60
61
|
#
|
61
62
|
#==============================================================================
|
62
63
|
module FreshBooks
|
63
|
-
VERSION = '3.0.
|
64
|
+
VERSION = '3.0.24' # Gem version
|
64
65
|
API_VERSION = '2.1' # FreshBooks API version
|
65
66
|
SERVICE_URL = "/api/#{API_VERSION}/xml-in"
|
66
67
|
|
data/lib/freshbooks/base.rb
CHANGED
@@ -19,10 +19,10 @@ module FreshBooks
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.new_from_xml(xml_root)
|
22
|
-
object = self.new
|
22
|
+
object = self.new()
|
23
23
|
|
24
24
|
self.schema_definition.members.each do |member_name, member_options|
|
25
|
-
node = xml_root.elements[member_name]
|
25
|
+
node = xml_root.elements[member_name.dup]
|
26
26
|
next if node.nil?
|
27
27
|
|
28
28
|
value = FreshBooks::XmlSerializer.to_value(node, member_options[:type])
|
@@ -32,7 +32,10 @@ module FreshBooks
|
|
32
32
|
return object
|
33
33
|
|
34
34
|
rescue => e
|
35
|
-
|
35
|
+
error = ParseError.new(e, xml_root.to_s)
|
36
|
+
error.set_backtrace(e.backtrace)
|
37
|
+
raise error
|
38
|
+
# raise ParseError.new(e, xml_root.to_s)
|
36
39
|
end
|
37
40
|
|
38
41
|
def to_xml(elem_name = nil)
|
data/test/test_base.rb
CHANGED
@@ -96,6 +96,22 @@ class TestBase < Test::Unit::TestCase
|
|
96
96
|
assert_equal invoice_1.to_xml, invoice_2.to_xml
|
97
97
|
end
|
98
98
|
|
99
|
+
def test_can_handle_all_zero_updated_at
|
100
|
+
xml = <<-END_XML
|
101
|
+
<my_client>
|
102
|
+
<client_id>3</client_id>
|
103
|
+
<first_name>Test</first_name>
|
104
|
+
<last_name>User</last_name>
|
105
|
+
<organization>User Testing</organization>
|
106
|
+
<updated>0000-00-00 00:00:00</updated>
|
107
|
+
</my_client>
|
108
|
+
END_XML
|
109
|
+
doc = REXML::Document.new(xml)
|
110
|
+
|
111
|
+
item = FreshBooks::MyClient.new_from_xml(doc.root)
|
112
|
+
assert_equal nil, item.updated
|
113
|
+
end
|
114
|
+
|
99
115
|
end
|
100
116
|
|
101
117
|
module FreshBooks
|
@@ -113,6 +129,14 @@ module FreshBooks
|
|
113
129
|
end
|
114
130
|
end
|
115
131
|
|
132
|
+
class MyClient < FreshBooks::Base
|
133
|
+
define_schema do |s|
|
134
|
+
s.string :first_name, :last_name, :organization
|
135
|
+
s.fixnum :client_id
|
136
|
+
s.date_time :updated
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
116
140
|
class MyAddress < FreshBooks::Base
|
117
141
|
define_schema do |s|
|
118
142
|
s.string :street1
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tedkulp-freshbooks.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 55
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 3
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 3.0.
|
9
|
+
- 24
|
10
|
+
version: 3.0.24
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Ben Curren
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-27 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: activesupport
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: newgem
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 25
|
39
44
|
segments:
|
40
45
|
- 1
|
41
46
|
- 2
|
@@ -47,9 +52,11 @@ dependencies:
|
|
47
52
|
name: mocha
|
48
53
|
prerelease: false
|
49
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
50
56
|
requirements:
|
51
57
|
- - ">="
|
52
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 51
|
53
60
|
segments:
|
54
61
|
- 0
|
55
62
|
- 9
|
@@ -61,9 +68,11 @@ dependencies:
|
|
61
68
|
name: hoe
|
62
69
|
prerelease: false
|
63
70
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
64
72
|
requirements:
|
65
73
|
- - ">="
|
66
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 55
|
67
76
|
segments:
|
68
77
|
- 1
|
69
78
|
- 8
|
@@ -138,23 +147,27 @@ rdoc_options:
|
|
138
147
|
require_paths:
|
139
148
|
- lib
|
140
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
141
151
|
requirements:
|
142
152
|
- - ">="
|
143
153
|
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
144
155
|
segments:
|
145
156
|
- 0
|
146
157
|
version: "0"
|
147
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
148
160
|
requirements:
|
149
161
|
- - ">="
|
150
162
|
- !ruby/object:Gem::Version
|
163
|
+
hash: 3
|
151
164
|
segments:
|
152
165
|
- 0
|
153
166
|
version: "0"
|
154
167
|
requirements: []
|
155
168
|
|
156
169
|
rubyforge_project: freshbooks.rb
|
157
|
-
rubygems_version: 1.3.
|
170
|
+
rubygems_version: 1.3.7
|
158
171
|
signing_key:
|
159
172
|
specification_version: 2
|
160
173
|
summary: ""
|