GithubHelp home page GithubHelp logo

netsuite's Introduction

Netsuite

  • This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API. Wow, that is a mouthful.
  • The gem does not cover the entire API, only the subset that we have found useful to cover so far.
  • Extending the wrapper is pretty simple. See below for an example.

Installation

Add this line to your application's Gemfile:

gem 'netsuite'

And then execute:

$ bundle

Or install it yourself as:

$ gem install netsuite

Usage

Customer

  • Initializing a customer can be done using a hash of attributes.

Get

  • Retrieves the customer by internalId.

    customer = NetSuite::Customer.get(4) # => #<NetSuite::Customer:0x1042f59b8>
    customer.is_person                   # => true
## Additions
  • Please submit a pull request for any models or actions that you would like to be included. The API is quite large and so we will necessarily not cover all of it.

  • Models should go into the lib/netsuite/models/ directory.

  • Actions should be placed in their respective subdirectory under lib/netsuite/actions.

  • Example:

    # lib/netsuite/actions/customer/add.rb
    
    module NetSuite
      module Actions
        module Customer
          class Add
    
            def initialize(attributes = {})
              @attributes = attributes
            end
    
            def self.call(attributes)
              new(attributes).call
            end
    
            def call
              response = NetSuite::Configuration.connection.request :add do
                soap.header =  NetSuite::Configuration.auth_header
                soap.body = {
                  :entityId    => @attributes[:entity_id],
                  :companyName => @attributes[:company_name],
                  :unsubscribe => @attributes[:unsubscribe]
                }
              end
              success = response.to_hash[:add_response][:write_response][:status][:@is_success] == 'true'
              body    = response.to_hash[:add_response][:write_response][:base_ref]
              NetSuite::Response.new(:success => success, :body => body)
            end
    
          end
        end
      end
    end
    
    response = NetSuite::Actions::Customer::Add.call(
      :entity_id    => 'Shutter Fly',
      :company_name => 'Shutter Fly, Inc.',
      :unsubscribe  => false
    )                 # => #<NetSuite::Response:0x1041f64b5>
    response.success? # => true
    response.body     # => { :internal_id => '979', :type => 'customer' }
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

netsuite's People

Contributors

ryanmoran avatar

Stargazers

 avatar

Watchers

 avatar  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.