Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

avalara_sdk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avalara_sdk

  • 24.2.29
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

avalara_sdk

AvalaraSdk - the Ruby gem for the Avalara Shipping Verification only

API for evaluating transactions against direct-to-consumer Beverage Alcohol shipping regulations.

This API is currently in beta.

  • Package version: 2.4.26

Installation

gem install avalara_sdk

Getting Started

Please follow the installation procedure and then run the following code:

require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::Avatax.configure do |config|
  # See Documentation for Authorization section for more auth examples.
  config.bearer_token='<Your Avalara Identity Access Token>'
  config.environment='sandbox'
  config.app_name='testApp'
  config.app_version='1.2.3'
  config.machine_name='testMachine'
end

api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::Avatax::V2::AddressesApi.new api_client

opts = {
  x_avalara_client: 'x_avalara_client_example', # String | Identifies the software you are using to call this API.  For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .
  body: AvalaraSdk::Avatax::V2::AddressValidationInfo.new # AddressValidationInfo | The address to resolve
}

begin
  # Retrieve geolocation information for a specified address
  result = api_instance.resolve_address_post(opts)
  p result
rescue AvalaraSdk::Avatax::ApiError => e
  puts "Error when calling AddressesApi->resolve_address_post: #{e}"
end

Documentation for Authorization

Authentication schemes defined for the API:

OAuth Client Credentials

  • Type: OAuth
  • Flow: client_credentials
  • Scopes:
    • avatax_api: avatax_api scope.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::Avatax.configure do |config|
  # See [Authorization Section](#documentation-for-authorization) for more auth examples.
  config.client_id='<Your Avalara Identity Client Id>'
  # Make sure to never check-in this value, should be stored in a secrets manager
  config.client_secret='<Your Avalara Identity Client Secret>'
  config.environment='sandbox'
  config.app_name='testApp'
  config.app_version='1.2.3'
  config.machine_name='testMachine'
end

api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::Avatax::V2::AddressesApi.new api_client

opts = {
  x_avalara_client: 'x_avalara_client_example', # String | Identifies the software you are using to call this API.  For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .
  body: AvalaraSdk::Avatax::V2::AddressValidationInfo.new # AddressValidationInfo | The address to resolve
}

begin
  # Retrieve geolocation information for a specified address
  # OAuth2 Client Credentials Flow will be invoked to retrieve the Bearer Token and it will be appended
  # to the request Authorization Header automaticaly by the SDK.
  result = api_instance.resolve_address_post(opts)
  p result
rescue AvalaraSdk::ApiError => e
  puts "Error when calling AddressesApi->resolve_address_post: #{e}"
end

OAuth Device Code

  • Type: OAuth
  • Flow: device_code
  • Scopes:
    • avatax_api: avatax_api scope.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::Avatax.configure do |config|
  config.client_id='<Your Avalara Identity Client Id>'
  config.environment='sandbox'
  config.app_name='testApp'
  config.app_version='1.2.3'
  config.machine_name='testMachine'
end

# Initiate device code flow for Authorization
device_auth_result = AvalaraSdk::Auth::OAuthHelper.initiate_device_authorization_flow("avatax_api", config)
# User Interaction needs to happen here - some polling logic is needed to wait for offline user to authenticate to verification_uri through browser
token_result = AvalaraSdk::Auth::OAuthHelper.get_access_token_for_device_flow(device_auth_result.device_code, config)
# Set bearer token into the config object which will be used by SDK to send Authorization header in requests.
config.bearer_token = token_result.access_token;

api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::Avatax::V2::AddressesApi.new api_client

opts = {
  x_avalara_client: 'x_avalara_client_example', # String | Identifies the software you are using to call this API.  For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .
  body: AvalaraSdk::Avatax::V2::AddressValidationInfo.new # AddressValidationInfo | The address to resolve
}

begin
  # Retrieve geolocation information for a specified address
  # OAuth2 Client Credentials Flow will be invoked to retrieve the Bearer Token and it will be appended
  # to the request Authorization Header automaticaly by the SDK.
  result = api_instance.resolve_address_post(opts)
  p result
rescue AvalaraSdk::ApiError => e
  puts "Error when calling AddressesApi->resolve_address_post: #{e}"
end

Documentation for API Endpoints

EInvoicing V1 API Documentation

ClassMethodHTTP requestDescription
DataInputFieldsApiget_data_input_fieldsGET /data-input-fieldsReturns the mandatory and conditional invoice or creditnote input fields for different country mandates
DocumentsApidownload_documentGET /documents/{documentId}/$downloadReturns a copy of the document
DocumentsApiget_document_listGET /documentsReturns a summary of documents for a date range
DocumentsApiget_document_statusGET /document/{documentId}/statusChecks the status of a document
DocumentsApisubmit_documentPOST /documentsSubmits a document to Avalara E-Invoicing API
MandatesApiget_mandatesGET /mandatesList country mandates that are supported by the Avalara E-Invoicing platform

Documentation for Models

EInvoicing V1 Model Documentation

FAQs

Package last updated on 21 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc