avalara 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +1 -0
  2. data/.rvmrc +1 -0
  3. data/CHANGELOG +5 -0
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +71 -0
  6. data/LICENSE +20 -0
  7. data/README +5 -0
  8. data/avalara.gemspec +28 -0
  9. data/lib/avalara.rb +101 -0
  10. data/lib/avalara/api.rb +23 -0
  11. data/lib/avalara/configuration.rb +29 -0
  12. data/lib/avalara/errors.rb +8 -0
  13. data/lib/avalara/parser.rb +41 -0
  14. data/lib/avalara/request.rb +11 -0
  15. data/lib/avalara/request/address.rb +19 -0
  16. data/lib/avalara/request/detail_level.rb +13 -0
  17. data/lib/avalara/request/invoice.rb +46 -0
  18. data/lib/avalara/request/line.rb +21 -0
  19. data/lib/avalara/response.rb +11 -0
  20. data/lib/avalara/response/invoice.rb +48 -0
  21. data/lib/avalara/response/message.rb +13 -0
  22. data/lib/avalara/response/tax_address.rb +16 -0
  23. data/lib/avalara/response/tax_detail.rb +16 -0
  24. data/lib/avalara/response/tax_line.rb +25 -0
  25. data/lib/avalara/types.rb +8 -0
  26. data/lib/avalara/types/date.rb +10 -0
  27. data/lib/avalara/types/stash.rb +28 -0
  28. data/lib/avalara/version.rb +5 -0
  29. data/spec/avalara.yml.example +2 -0
  30. data/spec/factories/addresses.rb +13 -0
  31. data/spec/factories/detail_levels.rb +7 -0
  32. data/spec/factories/invoices.rb +17 -0
  33. data/spec/factories/lines.rb +14 -0
  34. data/spec/fixtures/net/geographical_tax_no_sales.yml +95 -0
  35. data/spec/fixtures/net/get_tax/failure.yml +68 -0
  36. data/spec/fixtures/net/get_tax/success.yml +106 -0
  37. data/spec/models/avalara/configuration_spec.rb +55 -0
  38. data/spec/models/avalara/request/address_spec.rb +24 -0
  39. data/spec/models/avalara/request/detail_level_spec.rb +18 -0
  40. data/spec/models/avalara/request/invoice_spec.rb +33 -0
  41. data/spec/models/avalara/request/line_spec.rb +25 -0
  42. data/spec/models/avalara_spec.rb +204 -0
  43. data/spec/spec_helper.rb +17 -0
  44. data/spec/support/avalara.rb +38 -0
  45. data/spec/support/factory_girl.rb +20 -0
  46. data/spec/support/vcr.rb +14 -0
  47. metadata +204 -0
@@ -0,0 +1,17 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ Bundler.require(:default, :development)
6
+
7
+ # Requires supporting files with custom matchers and macros, etc.,
8
+ # in ./support/ and its subdirectories.
9
+ Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |file|
10
+ require(file)
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :rspec
15
+ config.filter_run :focus => true
16
+ config.run_all_when_everything_filtered = true
17
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'pathname'
4
+
5
+ path = Pathname.new(File.expand_path('../../avalara.yml', __FILE__))
6
+
7
+ if path.exist?
8
+ begin
9
+ AVALARA_CONFIGURATION = YAML.load_file(path)
10
+ Avalara.configure do |config|
11
+ config.username = AVALARA_CONFIGURATION['username'] || abort("Avalara configuration file (#{path}) is missing the username value.")
12
+ config.password = AVALARA_CONFIGURATION['password'] || abort("Avalara configuration file (#{path}) is missing the password value.")
13
+ config.version = AVALARA_CONFIGURATION['version'] if AVALARA_CONFIGURATION.has_key?('version')
14
+ config.endpoint = AVALARA_CONFIGURATION['endpoint'] if AVALARA_CONFIGURATION.has_key?('endpoint')
15
+ end
16
+ rescue NoMethodError
17
+ abort "Avalara configuration file (#{path}) is malformatted or unreadable."
18
+ end
19
+ else
20
+ abort "Avalara test configuration (#{path}) not found."
21
+ end
22
+
23
+ module ConfigurationSpecHelpers
24
+ def maintain_contactology_configuration
25
+ before(:each) do
26
+ @_isolated_configuration = Avalara.configuration
27
+ Avalara.configuration = @_isolated_configuration.dup
28
+ end
29
+
30
+ after(:each) do
31
+ Avalara.configuration = @_isolated_configuration
32
+ end
33
+ end
34
+ end
35
+
36
+ RSpec.configure do |config|
37
+ config.extend ConfigurationSpecHelpers
38
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: UTF-8
2
+
3
+ Dir[File.expand_path('../../factories', __FILE__) + '/*.rb'].each do |factory|
4
+ require factory
5
+ end
6
+
7
+ def Factory.build_via_new(name, attributes = {})
8
+ attributes = Factory.attributes_for(name).merge(attributes)
9
+ klass = FactoryGirl.factory_by_name(name).build_class
10
+ klass.new(attributes)
11
+ end
12
+
13
+ ##
14
+ # Override the default Factory() create alias method to build the attributes
15
+ # hash, then create them all though the new method. This gets around :required
16
+ # attribute issues in Hashie objects.
17
+ #
18
+ def Factory(name, attributes = {})
19
+ Factory.build_via_new(name, attributes).save!
20
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: UTF-8
2
+
3
+ VCR.config do |config|
4
+ config.cassette_library_dir = File.expand_path('../../fixtures/net', __FILE__)
5
+ config.default_cassette_options = { :record => :none }
6
+ config.stub_with :webmock
7
+ config.filter_sensitive_data('%{API_USERNAME}') { AVALARA_CONFIGURATION['username'] }
8
+ config.filter_sensitive_data('%{API_PASSWORD}') { AVALARA_CONFIGURATION['password'] }
9
+ config.filter_sensitive_data('%{API_ENDPOINT}') { AVALARA_CONFIGURATION['endpoint'] }
10
+ end
11
+
12
+ RSpec.configure do |config|
13
+ config.extend(VCR::RSpec::Macros)
14
+ end
metadata ADDED
@@ -0,0 +1,204 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avalara
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Adam Fortuna
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-02-03 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hashie
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: httparty
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: multi_json
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.4
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: vcr
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :development
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: webmock
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ type: :development
69
+ version_requirements: *id005
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ prerelease: false
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ type: :development
80
+ version_requirements: *id006
81
+ - !ruby/object:Gem::Dependency
82
+ name: factory_girl
83
+ prerelease: false
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id007
92
+ - !ruby/object:Gem::Dependency
93
+ name: ruby-debug19
94
+ prerelease: false
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ type: :development
102
+ version_requirements: *id008
103
+ description: This library provides Ruby calls to interact with the Avalara Tax API
104
+ email:
105
+ - adam@envylabs.com
106
+ executables: []
107
+
108
+ extensions: []
109
+
110
+ extra_rdoc_files: []
111
+
112
+ files:
113
+ - .gitignore
114
+ - .rvmrc
115
+ - CHANGELOG
116
+ - Gemfile
117
+ - Gemfile.lock
118
+ - LICENSE
119
+ - README
120
+ - avalara.gemspec
121
+ - lib/avalara.rb
122
+ - lib/avalara/api.rb
123
+ - lib/avalara/configuration.rb
124
+ - lib/avalara/errors.rb
125
+ - lib/avalara/parser.rb
126
+ - lib/avalara/request.rb
127
+ - lib/avalara/request/address.rb
128
+ - lib/avalara/request/detail_level.rb
129
+ - lib/avalara/request/invoice.rb
130
+ - lib/avalara/request/line.rb
131
+ - lib/avalara/response.rb
132
+ - lib/avalara/response/invoice.rb
133
+ - lib/avalara/response/message.rb
134
+ - lib/avalara/response/tax_address.rb
135
+ - lib/avalara/response/tax_detail.rb
136
+ - lib/avalara/response/tax_line.rb
137
+ - lib/avalara/types.rb
138
+ - lib/avalara/types/date.rb
139
+ - lib/avalara/types/stash.rb
140
+ - lib/avalara/version.rb
141
+ - spec/avalara.yml.example
142
+ - spec/factories/addresses.rb
143
+ - spec/factories/detail_levels.rb
144
+ - spec/factories/invoices.rb
145
+ - spec/factories/lines.rb
146
+ - spec/fixtures/net/geographical_tax_no_sales.yml
147
+ - spec/fixtures/net/get_tax/failure.yml
148
+ - spec/fixtures/net/get_tax/success.yml
149
+ - spec/models/avalara/configuration_spec.rb
150
+ - spec/models/avalara/request/address_spec.rb
151
+ - spec/models/avalara/request/detail_level_spec.rb
152
+ - spec/models/avalara/request/invoice_spec.rb
153
+ - spec/models/avalara/request/line_spec.rb
154
+ - spec/models/avalara_spec.rb
155
+ - spec/spec_helper.rb
156
+ - spec/support/avalara.rb
157
+ - spec/support/factory_girl.rb
158
+ - spec/support/vcr.rb
159
+ homepage: https://github.com/adamfortuna/avalara
160
+ licenses: []
161
+
162
+ post_install_message:
163
+ rdoc_options: []
164
+
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: "0"
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "0"
179
+ requirements: []
180
+
181
+ rubyforge_project:
182
+ rubygems_version: 1.8.15
183
+ signing_key:
184
+ specification_version: 3
185
+ summary: A Ruby interface to the Avalara Tax API
186
+ test_files:
187
+ - spec/avalara.yml.example
188
+ - spec/factories/addresses.rb
189
+ - spec/factories/detail_levels.rb
190
+ - spec/factories/invoices.rb
191
+ - spec/factories/lines.rb
192
+ - spec/fixtures/net/geographical_tax_no_sales.yml
193
+ - spec/fixtures/net/get_tax/failure.yml
194
+ - spec/fixtures/net/get_tax/success.yml
195
+ - spec/models/avalara/configuration_spec.rb
196
+ - spec/models/avalara/request/address_spec.rb
197
+ - spec/models/avalara/request/detail_level_spec.rb
198
+ - spec/models/avalara/request/invoice_spec.rb
199
+ - spec/models/avalara/request/line_spec.rb
200
+ - spec/models/avalara_spec.rb
201
+ - spec/spec_helper.rb
202
+ - spec/support/avalara.rb
203
+ - spec/support/factory_girl.rb
204
+ - spec/support/vcr.rb