avatax 17.7.0 → 17.7.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b088786169c533591b743fd4460e1136dc0460f7
4
- data.tar.gz: 50ac24f14e1c1142a05cbce53367b822e8e84ea9
3
+ metadata.gz: f91622695347c4040a71f175e5b217c4a90049a2
4
+ data.tar.gz: 4fdcbb988386306d7d8d1e4871fcc7b8a8cfdb01
5
5
  SHA512:
6
- metadata.gz: 1ae9d96449e719193fa053f4bb3ca72d8cdc42952bc811f00b9b2c75c252dc687155b79b2f11f7f30f708a7b9e1b140652c793cf92796e839cc1c2c241f04b21
7
- data.tar.gz: 94c154fe634fa2a7bb62f86112897385123bce3c429b172c85c0547f6feb9c2df14a9afdbce1dc639fa31aac5e6f68204754707f3b4eef8d0e8a1e90da6a24c3
6
+ metadata.gz: bd4cc8cefb18f556b6dbe8bf29375bed4da326c282bbfc74c4763b810b82a807836a9fa3daed3c445c1d18977f04f3cf91aae4c217a78f3d7705576ee86e43c3
7
+ data.tar.gz: fba6bea77a3fc36619eb1efe3accd0561137c0ff8655493e4f79f3a8c397c3b7b2e5467a0bd951dba7af104385c71a0bedc56e41f68086a074d7e148335d2528
@@ -8,6 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.add_runtime_dependency('faraday_middleware', '>= 0.10')
9
9
  s.add_runtime_dependency('multi_json', '>= 1.0.3')
10
10
  s.add_runtime_dependency('hashie', '>= 3.0.0')
11
+ s.add_runtime_dependency('faraday_middleware-parse_oj', '~> 0.3.2')
11
12
  s.authors = ["Marcus Vorwaller"]
12
13
  s.description = %q{A Ruby wrapper for the AvaTax REST and Search APIs}
13
14
  s.post_install_message =<<eos
@@ -26,9 +26,9 @@ module AvaTax
26
26
  # @param include [String] A comma separated list of child objects to return underneath the primary object.
27
27
  # @param model [Object] information about the transaction and lines to be added
28
28
  # @return [Object]
29
- def add_lines(model, options={})
29
+ def add_lines(model)
30
30
  path = "/api/v2/companies/transactions/lines/add"
31
- post(path, model, options)
31
+ post(path, model)
32
32
  end
33
33
 
34
34
 
@@ -181,9 +181,9 @@ module AvaTax
181
181
  # @param include [String] A comma separated list of child objects to return underneath the primary object.
182
182
  # @param model [Object] The transaction you wish to create
183
183
  # @return [Object]
184
- def create_or_adjust_transaction(model, options={})
184
+ def create_or_adjust_transaction(model)
185
185
  path = "/api/v2/transactions/createoradjust"
186
- post(path, model, options)
186
+ post(path, model)
187
187
  end
188
188
 
189
189
 
@@ -210,9 +210,9 @@ module AvaTax
210
210
  # @param include [String] A comma separated list of child objects to return underneath the primary object.
211
211
  # @param model [Object] The transaction you wish to create
212
212
  # @return [Object]
213
- def create_transaction(model, options={})
213
+ def create_transaction(model)
214
214
  path = "/api/v2/transactions/create"
215
- post(path, model, options)
215
+ post(path, model)
216
216
  end
217
217
 
218
218
 
@@ -236,9 +236,9 @@ module AvaTax
236
236
  # @param include [String] A comma separated list of child objects to return underneath the primary object.
237
237
  # @param model [Object] information about the transaction and lines to be removed
238
238
  # @return [Object]
239
- def delete_lines(model, options={})
239
+ def delete_lines(model)
240
240
  path = "/api/v2/companies/transactions/lines/delete"
241
- post(path, model, options)
241
+ post(path, model)
242
242
  end
243
243
 
244
244
 
@@ -379,9 +379,9 @@ module AvaTax
379
379
  # @param include [String] A comma separated list of child objects to return underneath the primary object.
380
380
  # @param model [Object] Information about the refund to create
381
381
  # @return [Object]
382
- def refund_transaction(companyCode, transactionCode, model, options={})
382
+ def refund_transaction(companyCode, transactionCode, model)
383
383
  path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/refund"
384
- post(path, model, options)
384
+ post(path, model)
385
385
  end
386
386
 
387
387
 
@@ -432,4 +432,4 @@ module AvaTax
432
432
 
433
433
  end
434
434
  end
435
- end
435
+ end
@@ -1,4 +1,4 @@
1
- require 'faraday_middleware'
1
+ require 'faraday_middleware/parse_oj'
2
2
 
3
3
  module AvaTax
4
4
 
@@ -6,23 +6,34 @@ module AvaTax
6
6
  private
7
7
 
8
8
  def connection
9
+ client_id = "#{app_name};#{app_version};RubySdk;#{AvaTax::VERSION.dup};#{machine_name}"
9
10
  options = {
10
- :headers => {'Accept' => "application/json; charset=utf-8", 'User-Agent' => user_agent},
11
+ :headers =>
12
+ {
13
+ 'Accept' => "application/json; charset=utf-8",
14
+ 'User-Agent' => user_agent,
15
+ 'X-Avalara-Client' => client_id
16
+ },
11
17
  :url => endpoint,
12
18
  :proxy => proxy,
13
19
  }.merge(connection_options)
14
20
 
15
- c = Faraday::Connection.new(options)
16
- if logger
17
- c.response :logger do |logger|
18
- logger.filter(/(Authorization\:\ \"Basic\ )(\w+)\=/, '\1[REMOVED]')
21
+ Faraday.new(options) do |faraday|
22
+ Oj.default_options = {
23
+ bigdecimal_load: :bigdecimal
24
+ }
25
+
26
+ faraday.response :oj, content_type: /\bjson$/
27
+ faraday.basic_auth(username, password)
28
+
29
+ if logger
30
+ faraday.response :logger do |logger|
31
+ logger.filter(/(Authorization\:\ \"Basic\ )(\w+)\=/, '\1[REMOVED]')
32
+ end
19
33
  end
20
- end
21
- c.use Faraday::Request::UrlEncoded
22
- c.use Faraday::Response::ParseJson
23
- c.basic_auth(username, password)
24
34
 
25
- c
35
+ faraday.adapter Faraday.default_adapter
36
+ end
26
37
  end
27
38
  end
28
39
  end
@@ -26,8 +26,8 @@ module AvaTax
26
26
  request.url(URI.encode(path), options)
27
27
  when :post, :put
28
28
  request.path = URI.encode(path)
29
- puts "BODY", options
30
- request.body = options unless options.empty?
29
+ request.headers['Content-Type'] = 'application/json'
30
+ request.body = options.to_json unless options.empty?
31
31
  end
32
32
  end
33
33
 
@@ -1,3 +1,3 @@
1
1
  module AvaTax
2
- VERSION = '17.7.0'.freeze unless defined?(::AvaTax::VERSION)
2
+ VERSION = '17.7.3'.freeze unless defined?(::AvaTax::VERSION)
3
3
  end
@@ -1,8 +1,6 @@
1
1
  require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  describe AvaTax do
4
- puts "Got env", ENV["SANDBOX_USERNAME"]
5
-
6
4
  after do
7
5
  AvaTax.reset
8
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avatax
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.7.0
4
+ version: 17.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Vorwaller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-31 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.0.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: faraday_middleware-parse_oj
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.3.2
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.3.2
111
125
  description: A Ruby wrapper for the AvaTax REST and Search APIs
112
126
  email:
113
127
  - marcus.vorwaller@avalara.com