Giter VIP home page Giter VIP logo

sk_sdk's Introduction

SalesKing SDK

Automate your workflow’s by integrating and connecting your business with SalesKing. This Ruby Software-Development-Kit provides solid and handy tools for building SalesKing App’s(using oAuth2) and API clients.

Install

gem install sk_sdk

Dependencies (gem’s):

  • activesupport

  • activeresource v3.1+ (v3.0.10 until sk_sdk v0.0.8)

  • httparty

  • sk_api_schema

Classes

All classes must be explicitly required so each can be used on their own.

require 'sk_sdk/signed_request'
require 'sk_sdk/oauth'
require 'sk_sdk/base'
require 'sk_sdk/sync'

API client

Uses ActiveResource to CRUD SalesKing object’s see usage in README

Get an oAuth2 access token and create oAuth related URL’s. There also is an omniAuth strategy.

De/encoding of signed_request parameter on canvas pages and PubSub/Webhook callbacks.

Map & Synchronize fields of a local with an remote object. Tackles the problem of normalizing objects to match internal data structures. Synchronization is done by a field-mapping and also sports transition methods for each way.

Usage

Read specs: github.com/salesking/sk_sdk/tree/master/spec/sk_sdk

Tests

Before you run the tests install required gems via bundler. We are providing several Gemfiles because of different patches for active_resource v2 vs v3. This definitly sucks, but as long as we stay with ARes we need to ensure it is working with every version.

Before running the specs, add your SalesKing credentials to /spec/settings.yml

cp spec/settings.yml.default spec/settings.yml

# test with most recent ARes version
bundle install
rake spec

#test with ActiveResource 3
BUNDLE_GEMFILE=ci/Gemfile_ar3 bundle install
BUNDLE_GEMFILE=ci/Gemfile_ar3 bundle exec rake spec

#test with ActiveResource 5
BUNDLE_GEMFILE=ci/Gemfile_ar5 bundle install
BUNDLE_GEMFILE=ci/Gemfile_ar5 bundle exec rake spec

Copyright © 2011-2022 Georg Leciejewski, released under the MIT license

sk_sdk's People

Contributors

holek avatar mlomnicki avatar schorsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

gertthiel

sk_sdk's Issues

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can image, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Make setup easier by having a base class

Setup is simpler and can be done by hand(no make needed) + users can monky-patch Base to add additional methods

class SK::SDK::Base < ActiveResource::Base
  extend SK::SDK::ClassMethods
  include SK::SDK::InstanceMethods
  self.format = :json
end

# only needed once
SK::SDK::Base.set_connection(
...
)

# simple object creating
class Client < SK::SDK::Base;end

# create objects in King namespace
%w[Client Invoice Product LineItem].each do |model|
  eval "class King::#{model} < SK::SDK::Base;end"
end

Rails 5 incompatibility

Hi,

We just upgraded to Rails 5 and our integration broke (while using 0.4.0).

After bumping to the latest version of the gem (0.4.1), we now get this error:

5: from /home/rousis/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:935:in `find'
4: from /home/rousis/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activeresource-5.0.0/lib/active_resource/base.rb:1027:in `find_every'
3: from /home/rousis/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sk_sdk-0.4.1/lib/sk_sdk/ar_patches/ar4/base.rb:28:in `instantiate_collection'
2: from /home/rousis/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sk_sdk-0.4.1/lib/sk_sdk/ar_patches/ar4/base.rb:28:in `new'
1: from /home/rousis/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activeresource-5.0.0/lib/active_resource/collection.rb:57:in `initialize'
ArgumentError (wrong number of arguments (given 2, expected 0..1))

Have you successfully tried with a Rails 5 app and it worked for you?

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.