cashboard 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,8 @@ begin
15
15
  gem.version = Cashboard::VERSION
16
16
  gem.add_development_dependency('mocha', '>= 0.9.8')
17
17
  gem.add_development_dependency('fakeweb', '>= 1.2.8')
18
- gem.add_dependency('activesupport', '>= 2.3.5')
18
+ gem.add_dependency('activesupport', '>= 3.0')
19
+ gem.add_dependency('i18n')
19
20
  gem.add_dependency('httparty', '>= 0.6.1')
20
21
  gem.add_dependency('xml-simple', '>= 1.0.12')
21
22
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cashboard}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Subimage LLC"]
12
- s.date = %q{2010-07-29}
12
+ s.date = %q{2011-11-05}
13
13
  s.description = %q{For more information see the homepage. Support and discussion can be found on the Cashboard forum (http://forum.getcashboard.com/)}
14
14
  s.email = %q{support@getcashboard.com}
15
15
  s.extra_rdoc_files = [
@@ -53,7 +53,6 @@ Gem::Specification.new do |s|
53
53
  "lib/cashboard/version.rb",
54
54
  "lib/typecasted_open_struct.rb",
55
55
  "test/fixtures/account.xml",
56
- "test/fixtures/cashboard_credentials.yml",
57
56
  "test/fixtures/client_companies.xml",
58
57
  "test/fixtures/client_contacts.xml",
59
58
  "test/fixtures/company_memberships.xml",
@@ -108,20 +107,23 @@ Gem::Specification.new do |s|
108
107
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
109
108
  s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
110
109
  s.add_development_dependency(%q<fakeweb>, [">= 1.2.8"])
111
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
110
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
111
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
112
112
  s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
113
113
  s.add_runtime_dependency(%q<xml-simple>, [">= 1.0.12"])
114
114
  else
115
115
  s.add_dependency(%q<mocha>, [">= 0.9.8"])
116
116
  s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
117
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
117
+ s.add_dependency(%q<activesupport>, [">= 3.0"])
118
+ s.add_dependency(%q<i18n>, [">= 0"])
118
119
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
119
120
  s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
120
121
  end
121
122
  else
122
123
  s.add_dependency(%q<mocha>, [">= 0.9.8"])
123
124
  s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
124
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
125
+ s.add_dependency(%q<activesupport>, [">= 3.0"])
126
+ s.add_dependency(%q<i18n>, [">= 0"])
125
127
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
126
128
  s.add_dependency(%q<xml-simple>, [">= 1.0.12"])
127
129
  end
@@ -2,10 +2,12 @@ $LOAD_PATH << File.join(File.dirname(__FILE__))
2
2
 
3
3
  require 'typecasted_open_struct'
4
4
  require 'rubygems'
5
- require 'active_support'
6
5
  require 'httparty'
7
6
  require 'xmlsimple'
8
7
  require 'builder'
8
+ require 'active_support'
9
+ require 'active_support/core_ext'
10
+ require 'active_support/inflector'
9
11
 
10
12
  module Cashboard
11
13
  # When reading the parsed hashes generated from parser we ignore these pairs.
@@ -47,15 +49,24 @@ end
47
49
  class HTTParty::Parser
48
50
  protected
49
51
  def xml
50
- XmlSimple.xml_in(
51
- body,
52
- 'KeepRoot' => false,
53
- # Force 'link' tags into an array always
54
- 'ForceArray' => %w(link),
55
- # Force each item into a hash with a 'content' key for the tag value
56
- # If we don't do this random tag attributes can screw us up.
57
- 'ForceContent' => true
58
- )
52
+ # We get instances of empty bodies for update and things.
53
+ # That can cause XmlSimple to bomb out.
54
+ #
55
+ # Rather return an empty hash than nothing at all.
56
+ if body.blank?
57
+ return {}
58
+ else
59
+ obj = XmlSimple.xml_in(
60
+ body,
61
+ 'KeepRoot' => false,
62
+ # Force 'link' tags into an array always
63
+ 'ForceArray' => %w(link),
64
+ # Force each item into a hash with a 'content' key for the tag value
65
+ # If we don't do this random tag attributes can screw us up.
66
+ 'ForceContent' => true
67
+ )
68
+ return obj
69
+ end
59
70
  end
60
71
  end
61
72
 
@@ -50,10 +50,9 @@ module Cashboard
50
50
  # Allows you to pass in a hash to create without naming it.
51
51
  #
52
52
  # Example:
53
- #
54
- # te = Cashboard::TimeEntry.create({
55
- # :minutes => 60, :project_id => 12345
56
- # })
53
+ # te = Cashboard::TimeEntry.create({
54
+ # :minutes => 60, :project_id => 12345
55
+ # })
57
56
  def self.create(params={}, options={})
58
57
  options = merge_options(options)
59
58
  options.merge!({:body => self.new(params).to_xml})
@@ -31,11 +31,11 @@ module Cashboard
31
31
 
32
32
  # Returns a hash of errors keyed on field name.
33
33
  #
34
- # Example
35
- # {
36
- # :field_name_one => "Error message",
37
- # :field_name_two => "Error message"
38
- # }
34
+ # Return Example
35
+ # {
36
+ # :field_name_one => "Error message",
37
+ # :field_name_two => "Error message"
38
+ # }
39
39
  def errors
40
40
  parsed_errors = XmlSimple.xml_in(response.response.body)
41
41
  error_hash = {}
@@ -1,3 +1,3 @@
1
1
  module Cashboard
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.0.2".freeze
3
3
  end
@@ -12,11 +12,10 @@ class Boolean; end
12
12
  #
13
13
  #
14
14
  # Example:
15
- #
16
15
  # class MyFoo < TypecastedOpenStruct
17
16
  # element :true_false_thing, Boolean
18
17
  # element :amount, Float
19
- # end
18
+ # end
20
19
  class TypecastedOpenStruct < OpenStruct
21
20
  @@elements = {}
22
21
 
@@ -1,3 +1,5 @@
1
+ # Should we try and connect to our test environment or not
2
+ # For local cashboard devs only.
1
3
  TEST_ENVIRONMENT = true
2
4
 
3
5
  require File.dirname(__FILE__) + '/../lib/cashboard'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cashboard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Subimage LLC
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-29 00:00:00 -07:00
18
+ date: 2011-11-05 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -58,18 +58,31 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- hash: 9
61
+ hash: 7
62
62
  segments:
63
- - 2
64
63
  - 3
65
- - 5
66
- version: 2.3.5
64
+ - 0
65
+ version: "3.0"
67
66
  type: :runtime
68
67
  version_requirements: *id003
69
68
  - !ruby/object:Gem::Dependency
70
- name: httparty
69
+ name: i18n
71
70
  prerelease: false
72
71
  requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :runtime
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: httparty
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
73
86
  none: false
74
87
  requirements:
75
88
  - - ">="
@@ -81,11 +94,11 @@ dependencies:
81
94
  - 1
82
95
  version: 0.6.1
83
96
  type: :runtime
84
- version_requirements: *id004
97
+ version_requirements: *id005
85
98
  - !ruby/object:Gem::Dependency
86
99
  name: xml-simple
87
100
  prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
101
+ requirement: &id006 !ruby/object:Gem::Requirement
89
102
  none: false
90
103
  requirements:
91
104
  - - ">="
@@ -97,7 +110,7 @@ dependencies:
97
110
  - 12
98
111
  version: 1.0.12
99
112
  type: :runtime
100
- version_requirements: *id005
113
+ version_requirements: *id006
101
114
  description: For more information see the homepage. Support and discussion can be found on the Cashboard forum (http://forum.getcashboard.com/)
102
115
  email: support@getcashboard.com
103
116
  executables: []
@@ -144,7 +157,6 @@ files:
144
157
  - lib/cashboard/version.rb
145
158
  - lib/typecasted_open_struct.rb
146
159
  - test/fixtures/account.xml
147
- - test/fixtures/cashboard_credentials.yml
148
160
  - test/fixtures/client_companies.xml
149
161
  - test/fixtures/client_contacts.xml
150
162
  - test/fixtures/company_memberships.xml
@@ -1,3 +0,0 @@
1
- test_account:
2
- subdomain: your_subdomain_here
3
- api_key: your_api_key