Giter Club home page Giter Club logo

lob-ruby's Introduction

lob-ruby-sdk

The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

This Ruby package is automatically generated by the OpenAPI Generator project:

  • API version: 1.3.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://support.lob.com/

Requirements

Ruby

Getting Started

Registration

First, you will need to first create an account at Lob.com and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the Settings Panel.

Installation & Usage

Install with the appropriate package manager.

Then add Lob's Ruby SDK to your Gemfile

gem install 'lob'

First API Call

require 'lob'

config = Lob::Configuration.default
config.username = ENV['LOB_API_TEST_KEY']

apiInstance = Lob::AddressesApi.new
addressEditable = Lob::AddressEditable.new({
    description: "Harry - Office",
    name: "Harry Zhang",
    company: "Lob",
    email: "[email protected]",
    phone: "5555555555",
    address_line1: "2261 Market Street",
    address_line2: "Ste 5668",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94114",
    address_country: "US",
});

begin
  #create
  result = apiInstance.create(addressEditable)
  p result
rescue Lob::ApiError => e
  puts "Exception when calling AddressesApi->create: #{e}"
end

API Documentation

The full and comprehensive documentation of Lob's APIs is available here.

Testing

First, install RSpec to run the tests. This can be done by running either of the following lines on your command line depending on whether you use Bundler:

$ bundle add rspec # with Bundler

$ gem install rspec # without Bundler

Unit Tests

$ rspec -P __tests__/Api/* --color --format doc

Integration Tests

Integration tests run against a live deployment of the Lob API and require multiple valid API keys with access to specific features. As such, it is not expected that these tests will pass for every user in every environment.

To run integration tests:

$ LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>> rspec -P __tests__/Integration/* --color --format doc

A cleaner alternative if you are going to run integration tests frequently

Run this the first time:

$ echo "LOB_API_TEST_KEY=<<YOUR TEST KEY>> LOB_API_LIVE_KEY=<<YOUR LIVE KEY>>" > LOCAL.env

Then, to run the integration tests:

$ env $(cat LOCAL.env) rspec -P __tests__/Integration/* --color --format doc

=======================

Copyright © 2022 Lob.com

Released under the MIT License, which can be found in the repository in LICENSE.txt.

lob-ruby's People

Contributors

bsiddiqui avatar hashnuke avatar bennykitchell avatar leore avatar mpiercy827 avatar jackcallister avatar pon avatar amity avatar sudoku-lord avatar amaan-lob avatar greysteil avatar robinjoseph08 avatar siddharthpant92 avatar mwj8410 avatar russelltaylor05 avatar elnaz avatar ami avatar rafadc avatar harry-zhang avatar shrav avatar juanfriss avatar ajorczak-lob avatar zcpdog avatar forbaokhanh avatar ajpawlicki avatar thexumaker avatar siannopollo avatar amrit avatar drcapulet avatar zachfeldman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.