avatax_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f8a0a91bddc6982d8b0096ba45662bcea0ae54d
4
- data.tar.gz: fbd08080cbdcea95f8be857d9f2b2da30fd68b5d
3
+ metadata.gz: 2646be3b73399b968abfeb5f70b6b905ad0c3773
4
+ data.tar.gz: 674682e7d06a67294aacdfc7b4748270c00179a2
5
5
  SHA512:
6
- metadata.gz: 51c9b887aabbfb2663740003bb2c26b10f7f4c6aecb0a5e227eee405cf76aaa1bc484ba6109e443b311f29380f7945cdd43ff649c5e268fa428b71177cb7e503
7
- data.tar.gz: 5c9f5bacfd4dfcb9c84f2112f637f9fe9ac59b75d2262d732f96b4db4d23a11e52efab7405f5e1e1a1fb3b1b871c319f9c31be7b9255792a2fa0d4c02c4b2b3f
6
+ metadata.gz: 1f418dfcfc9e9c7191032c7ad0adaa2a60635f70d73d9877c7bd2e404070195e4bb4e37dba984a4306b837d4743d7b425a7a82079bdf7c4c089c47fc0fe95d5e
7
+ data.tar.gz: 1e37013f540388666b079fd6c1f8046e1a8ee914e70818180d6f06ebfbeaf78a477ff9acf5fe191cdcc64df60587b4a6a88621454b0f23d2f9a0974e430cbaf5
@@ -0,0 +1,67 @@
1
+ # avatax_client
2
+
3
+ Reduce the burden of integration with the Avalara Avatax API. Avatax simplifies the calculation taxes. This project is targeted at their more recent REST API (v2 and up).
4
+
5
+ [![CircleCI](https://circleci.com/gh/C-S-D/avatax_client.svg?style=svg)](https://circleci.com/gh/C-S-D/avatax_client)
6
+ [![Code Climate](https://codeclimate.com/github/C-S-D/avatax_client/badges/gpa.svg)](https://codeclimate.com/github/C-S-D/avatax_client)
7
+ [![Test Coverage](https://codeclimate.com/github/C-S-D/avatax_client/badges/coverage.svg)](https://codeclimate.com/github/C-S-D/avatax_client/coverage)
8
+ [![Issue Count](https://codeclimate.com/github/C-S-D/avatax_client/badges/issue_count.svg)](https://codeclimate.com/github/C-S-D/avatax_client)
9
+
10
+ ## Usage
11
+
12
+ ### Setup
13
+
14
+ Configure endpoint and credentials via an initializer:
15
+ ```
16
+ AvataxClient.configure do |config|
17
+ config.username = ENV["AVALARA_USERNAME"]
18
+ config.password = ENV["AVALARA_PASSWORD"]
19
+ config.version = "v2"
20
+ config.endpoint = ENV["AVALARA_ENDPOINT"] || "https://sandbox-rest.avatax.com"
21
+ config.tax_codes = OpenStruct.new(foo_tax_code: "foo_tax_code")
22
+ config.item_codes = OpenStruct.new(foo_item_code: "foo_item_code")
23
+ # will call `debug_response` before the `response` object is evaluated in `AvataxClient::Request::Base.handle_response`
24
+ config.debug = true
25
+
26
+ # useful when you want to view the json in the response for test fixtures, etc.
27
+ config.debug_response = lambda { |response|
28
+ # either use defaults or override here
29
+ # see AvataxClient::Configuration
30
+ }
31
+ end
32
+ ```
33
+
34
+ ### Creating a Transaction (get taxes)
35
+ ```
36
+ # see lib/avatax_client/request/transaction.rb and related models for details on the attributes
37
+ # attributes is a Hash
38
+ transaction = AvataxClient::Request::Transaction.new(attributes)
39
+
40
+ response_transaction = transaction.create!
41
+
42
+ # see lib/avatax_client/response/transaction.rb
43
+ response_transaction.total_tax
44
+
45
+ # see lib/avatax_client/response/line_item.rb
46
+ response_transaction.lines
47
+
48
+ # see lib/avatax_client/response/line_item_detail.rb
49
+ response_transaction.lines.first.details
50
+
51
+ ```
52
+
53
+ ## Contributing
54
+ There are many api calls, models and model attributes to account for. Our team is adding what we need, but we welcome PRs.
55
+
56
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
57
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
58
+ * Fork the project.
59
+ * Start a feature/bugfix branch.
60
+ * Commit and push until you are happy with your contribution.
61
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
62
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
63
+
64
+ ## Copyright
65
+
66
+ Copyright (c) 2017 Communication Service for the Deaf (CSD www.csd.org). See LICENSE.txt for
67
+ further details.
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/dependencies/autoload"
4
+ require "hashie"
5
+ require "typhoeus"
6
+
7
+ # Avalara Tax calculation service.
8
+ module AvataxClient
9
+ extend ActiveSupport::Autoload
10
+
11
+ autoload :Configuration
12
+ autoload :Request
13
+ autoload :Response
14
+ autoload :Errors
15
+
16
+ class << self
17
+ attr_writer :configuration
18
+
19
+ def configuration
20
+ @configuration ||= Configuration.new
21
+ end
22
+
23
+ def configure
24
+ yield configuration
25
+ end
26
+
27
+ # Resets the configuration back to a new instance. Should only be used in testing.
28
+ def reset
29
+ @configuration = Configuration.new
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Configuration class to manage settings for Avatax
4
+ class AvataxClient::Configuration
5
+ attr_accessor :debug, :debug_response, :endpoint, :item_codes, :password, :tax_codes, :username, :version
6
+
7
+ # rubocop:disable Metrics/MethodLength
8
+ def initialize
9
+ @item_codes = OpenStruct.new
10
+ @endpoint = nil
11
+ @password = nil
12
+ @tax_codes = OpenStruct.new
13
+ @username = nil
14
+ @version = nil
15
+ @debug = false
16
+ @debug_response = lambda { |response|
17
+ puts "Response Debug"
18
+ puts "Response Code:"
19
+ puts response.code
20
+ puts "Response Body:"
21
+ puts response.body
22
+ }
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Errors from the API response
4
+ module AvataxClient::Errors
5
+ # Encapsulates error responses from Avatax api calls.
6
+ class ApiError < StandardError
7
+ attr_reader :response
8
+ # @param response [Typhoeus::Response] response from api call.
9
+ # @return [void]
10
+ def initialize(response = { "error" => {} })
11
+ @response = OpenStruct.new(response["error"])
12
+ super
13
+ end
14
+ end
15
+
16
+ # Request timedout
17
+ class TimeoutError < StandardError; end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Loads child models for handling requests.
4
+ module AvataxClient::Request
5
+ autoload :Address, "avatax_client/request/address"
6
+ autoload :Base, "avatax_client/request/base"
7
+ autoload :LineItem, "avatax_client/request/line_item"
8
+ autoload :Transaction, "avatax_client/request/transaction"
9
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Handles modeling of Address when performing requests (create / update)
4
+ class AvataxClient::Request::Address < AvataxClient::Request::Base
5
+ property :city, required: :not_geocoded?
6
+ property :country, required: :not_geocoded?
7
+ # Values: ShipFrom, ShipTo, PointOfOrderAcceptance, PointOfOrderOrigin, SingleLocation
8
+ property :label, required: true
9
+ property :latitude
10
+ property :longitude
11
+ property :line1, required: :not_geocoded?
12
+ property :line2
13
+ property :line3
14
+ property :region, required: :not_geocoded?
15
+ property :postal_code, required: :not_geocoded?, from: :postalCode
16
+
17
+ ## Class Methods
18
+ class << self
19
+ # Transform a colleciton of {Address} into a format compatible with Avatax.
20
+ # @param [Array<Address>]
21
+ # @return [Hash]
22
+ def collection_to_body(addresses = [])
23
+ addresses.reduce({}) { |a, e| a.merge!(e.to_body) }
24
+ end
25
+ end
26
+
27
+ ## Instance Methods
28
+
29
+ # Transform Hash into a version compatible with Avatax.
30
+ # Removes `label` attribute from hash, as it is used as the parent key in `addresses: {}`.
31
+ # @return [Hash]
32
+ def to_body
33
+ hash = super
34
+
35
+ label = hash[:label]
36
+ hash.delete(:label)
37
+ hash = { label => hash }
38
+
39
+ hash
40
+ end
41
+
42
+ private
43
+
44
+ def not_geocoded?
45
+ return true if latitude.nil? || longitude.nil?
46
+ false
47
+ end
48
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "avatax_client/errors"
4
+ require "avatax_client/reverse_coercion"
5
+
6
+ # Base class for handling requests from Avatax.
7
+ class AvataxClient::Request::Base < Hashie::Dash
8
+ include Hashie::Extensions::Dash::PropertyTranslation
9
+ include Hashie::Extensions::Dash::Coercion
10
+ include AvataxClient::ReverseCoercion
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ ## ClassMethods
14
+ class << self
15
+ private
16
+
17
+ # Provide a hook to allow user to debug a response.
18
+ # @param response [Typhoeus::Response] response from api call.
19
+ # @return [void]
20
+ def check_debug(response:)
21
+ if AvataxClient.configuration.debug
22
+ AvataxClient.configuration.debug_response.call(response)
23
+ end
24
+ end
25
+
26
+ # @param response [Typhoeus::Response] response from api call.
27
+ # @return [AvataxClient::Response, AvataxClient::Errors]
28
+ def handle_response(response:)
29
+ check_debug(response: response)
30
+
31
+ hash = JSON.parse(response.body)
32
+ if response.success?
33
+ to_s.gsub("Request", "Response").constantize.new(hash)
34
+ elsif response.timed_out?
35
+ raise AvataxClient::Errors::TimeoutError
36
+ else
37
+ msg = hash.dig("error", "code") || "Error"
38
+ raise AvataxClient::Errors::ApiError.new(hash), msg
39
+ end
40
+ end
41
+
42
+ def headers
43
+ { "Content-Type" => "application/json", "Accept" => "application/json" }
44
+ end
45
+
46
+ def credentials
47
+ avatax = AvataxClient.configuration
48
+ "#{avatax.username}:#{avatax.password}"
49
+ end
50
+
51
+ def url(path)
52
+ config = AvataxClient.configuration
53
+ endpoint = config.endpoint
54
+ version = config.version
55
+
56
+ URI.join(endpoint, ["api", version, path].join("/")).to_s
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request (create / update )
4
+ class AvataxClient::Request::LineItem < AvataxClient::Request::Base
5
+ property :addresses, coerce: Array[AvataxClient::Request::Address], default: []
6
+ property :amount, required: true
7
+ property :item_code, from: :itemCode
8
+ property :number, coerce: Integer
9
+ property :quantity, required: true
10
+ property :tax_code, from: :taxCode
11
+ end
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Handles requests to Avatax api dealing with Transactions.
4
+ class AvataxClient::Request::Transaction < AvataxClient::Request::Base
5
+ # only required if needing to set an Address for the entire transaction
6
+ property :addresses, coerce: Array[AvataxClient::Request::Address], default: []
7
+ property :code
8
+ property :commit
9
+ property :company_code, from: :companyCode, required: true
10
+ property :customer_code, from: :customerCode, required: true
11
+ property :date, required: true
12
+ property :lines, required: true, coerce: Array[AvataxClient::Request::LineItem]
13
+ property :type
14
+
15
+ ## ClassMethods
16
+ class << self
17
+ # Reasons to make an adjustment to a Avatax Transaction.
18
+ # @return [OpenStruct]
19
+ #
20
+ # rubocop:disable Metrics/MethodLength
21
+ def adjustment_reasons
22
+ OpenStruct.new(
23
+ bad_debt: "BadDebt",
24
+ exempt_cert: "ExemptCertApplied",
25
+ not_adjusted: "NotAdjusted",
26
+ offline: "Offline",
27
+ other: "Other",
28
+ price_adjusted: "PriceAdjusted",
29
+ product_exchanged: "ProductExchanged",
30
+ product_returned: "ProductReturned",
31
+ reconciled: "ReconciledWithGeneralLedger",
32
+ sourcing_issue: "SourcingIssue"
33
+ )
34
+ end
35
+ # rubocop:enable Metrics/MethodLength
36
+
37
+ # @param adjustment_reason [String] @see http://developer.avalara.com/avatax/api-reference/tax/v2/Transactions/#ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeAdjustPost
38
+ # @param adjustment_description [String] description as to why the adjustment was made.
39
+ # @param transaction [AvataxClient::Request::Transaction]
40
+ # @return (see AvataxClient::Request::Base.handle_response)
41
+ def adjust!(adjustment_reason:, adjustment_description: "", transaction:)
42
+ body_params = {
43
+ adjustmentReason: adjustment_reason,
44
+ adjustmentDescription: adjustment_description,
45
+ newTransaction: transaction.to_body
46
+ }
47
+ body = JSON.generate(body_params.delete_if { |_key, value| value.blank? })
48
+
49
+ path = "companies/#{transaction.company_code}/transactions/#{transaction.code}/adjust"
50
+ res = Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
51
+ handle_response(response: res)
52
+ end
53
+
54
+ # @param transaction [AvataxClient::Request::Transaction]
55
+ # @return (see AvataxClient::Request::Base.handle_response)
56
+ def create!(transaction:)
57
+ path = "transactions/create"
58
+ hash = transaction.to_body
59
+ body = JSON.generate(hash)
60
+ res = Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
61
+ handle_response(response: res)
62
+ end
63
+
64
+ # Changes an uncommitted transaction into a committed transaction.
65
+ # @param company_code [String] unique code identifying the company
66
+ # @param transaction_code [String] unique code identifying the transaction
67
+ # @return (see AvataxClient::Request::Base.handle_response)
68
+ def commit!(company_code:, transaction_code:)
69
+ path = "companies/#{company_code}/transactions/#{transaction_code}/commit"
70
+ body = JSON.generate(commit: true)
71
+ res = Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
72
+ handle_response(response: res)
73
+ end
74
+
75
+ # Commenting out for now. Need to add tests and circle back.
76
+
77
+ # Deletes a transaction in Avalara by uncommitting it.
78
+ # @param company_code [String] identifies the Company tax profile in Avalara
79
+ # @param transaction_code [String] unique identifier of the transaction
80
+ # @return [boolean]
81
+ # def void(company_code:, transaction_code:)
82
+ # params = { code: "DocDeleted" }
83
+ # path = "companies/#{company_code}/transactions/#{transaction_code}/void"
84
+ # body = JSON.generate(params)
85
+ # Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
86
+ # end
87
+
88
+ # def adjust(adjustment_reason:, adjustment_description: "", company_code:, transaction:, transaction_code:)
89
+ # body_params = {
90
+ # adjustmentReason: adjustment_reason,
91
+ # adjustmentDescription: adjustment_description,
92
+ # newTransaction: transaction.build_body
93
+ # }
94
+ # body = JSON.generate(body_params.delete_if { |_key, value| value.blank? })
95
+
96
+ # path = "companies/#{company_code}/transactions/#{transaction_code}/adjust"
97
+ # res = Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
98
+ # handle_response(response: res)
99
+ # end
100
+
101
+ # def change_code(company_code:, transaction_code:, new_code:)
102
+ # path = "companies/#{company_code}/transactions/#{transaction_code}/changecode"
103
+ # body_params = { "newCode" => new_code }
104
+ # body = JSON.generate(body_params)
105
+ # res = Typhoeus.post(url(path), body: body, headers: headers, userpwd: credentials)
106
+ # handle_response(response: res)
107
+ # end
108
+
109
+ # def get(company_code:, transaction_code:, include: "")
110
+ # path = "companies/#{company_code}/transactions/#{transaction_code}"
111
+ # res = Typhoeus.get(url(path), headers: headers, params: { "$include" => include }, userpwd: credentials)
112
+ # handle_response(response: res)
113
+ # end
114
+
115
+ # def find_by_id(id:)
116
+ # path = "transactions/#{id}"
117
+ # res = Typhoeus.get(url(path), headers: headers, userpwd: credentials)
118
+ # handle_response(response: res)
119
+ # end
120
+ end
121
+
122
+ ## Instance methods
123
+
124
+ # @see {.adjust!}
125
+ def adjust!(adjustment_description: "", adjustment_reason:)
126
+ self.class.adjust!(adjustment_description: adjustment_description, adjustment_reason: adjustment_reason,
127
+ transaction: self)
128
+ end
129
+
130
+ # @see {.create!}
131
+ def create!
132
+ self.class.create!(transaction: self)
133
+ end
134
+
135
+ # @see {.commit!}
136
+ def commit!
137
+ self.class.commit!(company_code: company_code, transaction_code: code)
138
+ end
139
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Loads child models for handling requests.
4
+ module AvataxClient::Response
5
+ autoload :Base, "avatax_client/response/base"
6
+ autoload :LineItem, "avatax_client/response/line_item"
7
+ autoload :LineItemDetail, "avatax_client/response/line_item_detail"
8
+ autoload :Transaction, "avatax_client/response/transaction"
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Base class for handling responses from Avatax.
4
+ class AvataxClient::Response::Base < Hashie::Dash
5
+ include Hashie::Extensions::Dash::PropertyTranslation
6
+ include Hashie::Extensions::Dash::Coercion
7
+ include Hashie::Extensions::IgnoreUndeclared
8
+ include Hashie::Extensions::IndifferentAccess
9
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Represents a line item on a {Response::Transaction}.
4
+ # Responsible for reporting dollar amounts, quantity and tax code.
5
+ class AvataxClient::Response::LineItem < AvataxClient::Response::Base
6
+ property :amount, from: :lineAmount, required: true
7
+ property :details, coerce: Array[AvataxClient::Response::LineItemDetail], required: true
8
+ property :item_code, from: :itemCode
9
+ property :number, coerce: Integer, from: :lineNumber, required: true
10
+ property :quantity, required: true
11
+ property :tax, coerce: Float, required: true
12
+ property :tax_calculated, coerce: Float, from: :taxCalculated, required: true
13
+ property :tax_code, from: :taxCode, required: true
14
+ property :taxable_amount, coerce: Float, from: :taxableAmount, required: true
15
+
16
+ # Effective tax rate is determined by summing the rate from the details.
17
+ # @return [float]
18
+ def rate
19
+ @rate ||= details.map(&:rate).reduce(&:+)
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Represents the details of a {LineItem} from a {Transaction}
4
+ class AvataxClient::Response::LineItemDetail < AvataxClient::Response::Base
5
+ property :rate, coerce: Float, required: true
6
+ property :region
7
+ property :tax, coerce: Float, required: true
8
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Handles modeling of the Transaction when receiving responses from Avatax.
4
+ class AvataxClient::Response::Transaction < AvataxClient::Response::Base
5
+ # skipping Address. don't have any need
6
+ property :code, required: true
7
+ property :customer_code, from: :customerVendorCode, required: true
8
+ property :date, required: true
9
+ property :lines, coerce: Array[AvataxClient::Response::LineItem], required: true
10
+ property :status, required: true
11
+ property :total_amount, from: :totalAmount, required: true
12
+ property :total_exempt, from: :totalExempt, required: true
13
+ property :total_tax, from: :totalTax, required: true
14
+ property :total_taxable, from: :totalTaxable, required: true
15
+ property :total_tax_calculated, from: :totalTaxCalculated, required: true
16
+ property :type, required: true
17
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Transform a hash into a format compatible with Avatax.
4
+ module AvataxClient::ReverseCoercion
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ ## Class methods
10
+ module ClassMethods
11
+ # Override to allow for Modification at the colleciton level.
12
+ # Defaults to calling `.to_body` for each element.
13
+ # @param values [Array] collection items to be transformed.
14
+ # @return [Array]
15
+ def collection_to_body(values)
16
+ values.map(&:to_body)
17
+ end
18
+ end
19
+
20
+ # Build a hash that can be used in the request body to Avatax API
21
+ # @return [Hash]
22
+ def to_body
23
+ hash = to_hash
24
+ hash = translate_names(hash)
25
+ hash = transform_collections(hash)
26
+ hash
27
+ end
28
+
29
+ private
30
+
31
+ def transform_collections(hash)
32
+ self.class.key_coercions.each do |k, v|
33
+ hash[k] = if v.is_a?(Array)
34
+ v.first.collection_to_body(hash[k])
35
+ elsif v.respond_to?(:to_body)
36
+ v.to_body
37
+ else
38
+ hash[k]
39
+ end
40
+ end
41
+ hash
42
+ end
43
+
44
+ def translate_names(hash)
45
+ self.class.inverse_translations.each do |k, v|
46
+ hash[v] = hash[k]
47
+ hash.delete(k)
48
+ end
49
+ hash
50
+ end
51
+ end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avatax_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Hamilton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: shoulda
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
19
+ version: '4.2'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.12'
34
- type: :development
33
+ version: 3.5.5
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.12'
40
+ version: 3.5.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: typhoeus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.2
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,21 +67,21 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: juwelier
70
+ name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 2.1.0
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 2.1.0
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: simplecov
84
+ name: dotenv
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -80,6 +94,20 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: juwelier
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.1.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.1.0
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rspec
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +128,28 @@ dependencies:
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: '0.48'
131
+ version: 0.47.0
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: '0.48'
138
+ version: 0.47.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: yard
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -123,33 +165,33 @@ dependencies:
123
165
  - !ruby/object:Gem::Version
124
166
  version: '0.9'
125
167
  - !ruby/object:Gem::Dependency
126
- name: hashie
168
+ name: rspec_junit_formatter
127
169
  requirement: !ruby/object:Gem::Requirement
128
170
  requirements:
129
- - - "~>"
171
+ - - '='
130
172
  - !ruby/object:Gem::Version
131
- version: 3.5.5
132
- type: :runtime
173
+ version: 0.2.2
174
+ type: :development
133
175
  prerelease: false
134
176
  version_requirements: !ruby/object:Gem::Requirement
135
177
  requirements:
136
- - - "~>"
178
+ - - '='
137
179
  - !ruby/object:Gem::Version
138
- version: 3.5.5
180
+ version: 0.2.2
139
181
  - !ruby/object:Gem::Dependency
140
- name: typhoeus
182
+ name: codeclimate-test-reporter
141
183
  requirement: !ruby/object:Gem::Requirement
142
184
  requirements:
143
185
  - - "~>"
144
186
  - !ruby/object:Gem::Version
145
- version: 1.1.2
146
- type: :runtime
187
+ version: 1.0.0
188
+ type: :development
147
189
  prerelease: false
148
190
  version_requirements: !ruby/object:Gem::Requirement
149
191
  requirements:
150
192
  - - "~>"
151
193
  - !ruby/object:Gem::Version
152
- version: 1.1.2
194
+ version: 1.0.0
153
195
  description: |-
154
196
  Reduce the burden of integration with the Avalara Avatax API.
155
197
  Avatax simplifies the calculation taxes.
@@ -160,18 +202,27 @@ extensions: []
160
202
  extra_rdoc_files:
161
203
  - LICENSE
162
204
  - LICENSE.txt
205
+ - README.md
163
206
  - README.rdoc
164
207
  files:
165
- - ".document"
166
- - Gemfile
167
- - Gemfile.lock
168
208
  - LICENSE
169
209
  - LICENSE.txt
210
+ - README.md
170
211
  - README.rdoc
171
- - Rakefile
172
- - VERSION
173
- - avatax_client.gemspec
174
212
  - lib/avatax_client.rb
213
+ - lib/avatax_client/configuration.rb
214
+ - lib/avatax_client/errors.rb
215
+ - lib/avatax_client/request.rb
216
+ - lib/avatax_client/request/address.rb
217
+ - lib/avatax_client/request/base.rb
218
+ - lib/avatax_client/request/line_item.rb
219
+ - lib/avatax_client/request/transaction.rb
220
+ - lib/avatax_client/response.rb
221
+ - lib/avatax_client/response/base.rb
222
+ - lib/avatax_client/response/line_item.rb
223
+ - lib/avatax_client/response/line_item_detail.rb
224
+ - lib/avatax_client/response/transaction.rb
225
+ - lib/avatax_client/reverse_coercion.rb
175
226
  homepage: http://github.com/C-S-D/avatax_client
176
227
  licenses:
177
228
  - MIT
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source "https://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
-
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "shoulda", ">= 0"
10
- gem "rdoc", "~> 3.12"
11
- gem "bundler", "~> 1.0"
12
- gem "juwelier", "~> 2.1.0"
13
- gem "simplecov", ">= 0"
14
- gem "rspec", "~> 3.0"
15
- gem "rubocop", "~> 0.48"
16
- gem "yard", "~> 0.9"
17
- end
@@ -1,116 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (5.0.2)
5
- concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (~> 0.7)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- addressable (2.4.0)
10
- ast (2.3.0)
11
- builder (3.2.3)
12
- concurrent-ruby (1.0.5)
13
- descendants_tracker (0.0.4)
14
- thread_safe (~> 0.3, >= 0.3.1)
15
- diff-lcs (1.3)
16
- docile (1.1.5)
17
- faraday (0.9.2)
18
- multipart-post (>= 1.2, < 3)
19
- git (1.3.0)
20
- github_api (0.15.0)
21
- addressable (~> 2.4.0)
22
- descendants_tracker (~> 0.0.4)
23
- faraday (~> 0.8, < 0.10)
24
- hashie (>= 3.4)
25
- mime-types (>= 1.16, < 3.0)
26
- oauth2 (~> 1.0)
27
- hashie (3.5.5)
28
- highline (1.7.8)
29
- i18n (0.8.1)
30
- json (1.8.6)
31
- juwelier (2.1.3)
32
- builder
33
- bundler (>= 1.13)
34
- git (>= 1.2.5)
35
- github_api
36
- highline (>= 1.6.15)
37
- nokogiri (>= 1.5.10)
38
- rake
39
- rdoc
40
- semver
41
- jwt (1.5.6)
42
- mime-types (2.99.3)
43
- mini_portile2 (2.1.0)
44
- minitest (5.10.1)
45
- multi_json (1.12.1)
46
- multi_xml (0.6.0)
47
- multipart-post (2.0.0)
48
- nokogiri (1.7.1)
49
- mini_portile2 (~> 2.1.0)
50
- oauth2 (1.3.1)
51
- faraday (>= 0.8, < 0.12)
52
- jwt (~> 1.0)
53
- multi_json (~> 1.3)
54
- multi_xml (~> 0.5)
55
- rack (>= 1.2, < 3)
56
- parser (2.4.0.0)
57
- ast (~> 2.2)
58
- powerpack (0.1.1)
59
- rack (2.0.1)
60
- rainbow (2.2.1)
61
- rake (12.0.0)
62
- rdoc (3.12.2)
63
- json (~> 1.4)
64
- rspec (3.5.0)
65
- rspec-core (~> 3.5.0)
66
- rspec-expectations (~> 3.5.0)
67
- rspec-mocks (~> 3.5.0)
68
- rspec-core (3.5.4)
69
- rspec-support (~> 3.5.0)
70
- rspec-expectations (3.5.0)
71
- diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.5.0)
73
- rspec-mocks (3.5.0)
74
- diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.5.0)
76
- rspec-support (3.5.0)
77
- rubocop (0.48.0)
78
- parser (>= 2.3.3.1, < 3.0)
79
- powerpack (~> 0.1)
80
- rainbow (>= 1.99.1, < 3.0)
81
- ruby-progressbar (~> 1.7)
82
- unicode-display_width (~> 1.0, >= 1.0.1)
83
- ruby-progressbar (1.8.1)
84
- semver (1.0.1)
85
- shoulda (3.5.0)
86
- shoulda-context (~> 1.0, >= 1.0.1)
87
- shoulda-matchers (>= 1.4.1, < 3.0)
88
- shoulda-context (1.2.2)
89
- shoulda-matchers (2.8.0)
90
- activesupport (>= 3.0.0)
91
- simplecov (0.14.1)
92
- docile (~> 1.1.0)
93
- json (>= 1.8, < 3)
94
- simplecov-html (~> 0.10.0)
95
- simplecov-html (0.10.0)
96
- thread_safe (0.3.6)
97
- tzinfo (1.2.3)
98
- thread_safe (~> 0.1)
99
- unicode-display_width (1.1.3)
100
- yard (0.9.8)
101
-
102
- PLATFORMS
103
- ruby
104
-
105
- DEPENDENCIES
106
- bundler (~> 1.0)
107
- juwelier (~> 2.1.0)
108
- rdoc (~> 3.12)
109
- rspec (~> 3.0)
110
- rubocop (~> 0.48)
111
- shoulda
112
- simplecov
113
- yard (~> 0.9)
114
-
115
- BUNDLED WITH
116
- 1.14.6
data/Rakefile DELETED
@@ -1,58 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'juwelier'
15
- Juwelier::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
- gem.name = "avatax_client"
18
- gem.homepage = "http://github.com/C-S-D/avatax_client"
19
- gem.license = "MIT"
20
- gem.summary = %Q{A Ruby interface to the Avalara Avatax API}
21
- gem.description = %Q{Reduce the burden of integration with the Avalara Avatax API.
22
- Avatax simplifies the calculation taxes.
23
- This project is targeted at their more recent REST API (v2 and up).}
24
- gem.email = "shamil614@gmail.com"
25
- gem.authors = ["Scott Hamilton"]
26
-
27
- # dependencies defined in Gemfile
28
- # Hashie is a growing collection of tools that extend Hashes and make them more useful.
29
- gem.add_dependency "hashie", "~> 3.5.5"
30
- # Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
31
- gem.add_dependency "typhoeus", "~> 1.1.2"
32
- end
33
- Juwelier::RubygemsDotOrgTasks.new
34
-
35
- require 'rake/testtask'
36
- Rake::TestTask.new(:test) do |test|
37
- test.libs << 'lib' << 'test'
38
- test.pattern = 'test/**/test_*.rb'
39
- test.verbose = true
40
- end
41
-
42
- desc "Code coverage detail"
43
- task :simplecov do
44
- ENV['COVERAGE'] = "true"
45
- Rake::Task['test'].execute
46
- end
47
-
48
- task :default => :test
49
-
50
- require 'rdoc/task'
51
- Rake::RDocTask.new do |rdoc|
52
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
53
-
54
- rdoc.rdoc_dir = 'rdoc'
55
- rdoc.title = "avatax_client #{version}"
56
- rdoc.rdoc_files.include('README*')
57
- rdoc.rdoc_files.include('lib/**/*.rb')
58
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.0
@@ -1,78 +0,0 @@
1
- # Generated by juwelier
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: avatax_client 0.1.0 ruby lib
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "avatax_client"
9
- s.version = "0.1.0"
10
-
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Scott Hamilton"]
14
- s.date = "2017-03-30"
15
- s.description = "Reduce the burden of integration with the Avalara Avatax API.\n Avatax simplifies the calculation taxes.\n This project is targeted at their more recent REST API (v2 and up)."
16
- s.email = "shamil614@gmail.com"
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "LICENSE.txt",
20
- "README.rdoc"
21
- ]
22
- s.files = [
23
- ".document",
24
- "Gemfile",
25
- "Gemfile.lock",
26
- "LICENSE",
27
- "LICENSE.txt",
28
- "README.rdoc",
29
- "Rakefile",
30
- "VERSION",
31
- "avatax_client.gemspec",
32
- "lib/avatax_client.rb"
33
- ]
34
- s.homepage = "http://github.com/C-S-D/avatax_client"
35
- s.licenses = ["MIT"]
36
- s.rubygems_version = "2.5.1"
37
- s.summary = "A Ruby interface to the Avalara Avatax API"
38
-
39
- if s.respond_to? :specification_version then
40
- s.specification_version = 4
41
-
42
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_development_dependency(%q<shoulda>, [">= 0"])
44
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
46
- s.add_development_dependency(%q<juwelier>, ["~> 2.1.0"])
47
- s.add_development_dependency(%q<simplecov>, [">= 0"])
48
- s.add_development_dependency(%q<rspec>, ["~> 3.0"])
49
- s.add_development_dependency(%q<rubocop>, ["~> 0.48"])
50
- s.add_development_dependency(%q<yard>, ["~> 0.9"])
51
- s.add_runtime_dependency(%q<hashie>, ["~> 3.5.5"])
52
- s.add_runtime_dependency(%q<typhoeus>, ["~> 1.1.2"])
53
- else
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
56
- s.add_dependency(%q<bundler>, ["~> 1.0"])
57
- s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
58
- s.add_dependency(%q<simplecov>, [">= 0"])
59
- s.add_dependency(%q<rspec>, ["~> 3.0"])
60
- s.add_dependency(%q<rubocop>, ["~> 0.48"])
61
- s.add_dependency(%q<yard>, ["~> 0.9"])
62
- s.add_dependency(%q<hashie>, ["~> 3.5.5"])
63
- s.add_dependency(%q<typhoeus>, ["~> 1.1.2"])
64
- end
65
- else
66
- s.add_dependency(%q<shoulda>, [">= 0"])
67
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
68
- s.add_dependency(%q<bundler>, ["~> 1.0"])
69
- s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
70
- s.add_dependency(%q<simplecov>, [">= 0"])
71
- s.add_dependency(%q<rspec>, ["~> 3.0"])
72
- s.add_dependency(%q<rubocop>, ["~> 0.48"])
73
- s.add_dependency(%q<yard>, ["~> 0.9"])
74
- s.add_dependency(%q<hashie>, ["~> 3.5.5"])
75
- s.add_dependency(%q<typhoeus>, ["~> 1.1.2"])
76
- end
77
- end
78
-