Sha256: 16ca947b380ac9795477039aaf043ae94b80f606775411b5176d0b6809f231fe

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'
# create all classes and set their connection
%w[Contact Address CreditNote Invoice Product LineItem User Payment Email].each do |model|
  eval "class #{model} < SK::SDK::Base;end" unless Object.const_defined?(model)
end
SK::SDK::Base.set_connection basic_auth_settings
# check if a SalesKing instance is available by calling /users/current.json
def sk_available?
  begin
    User.get(:current)
  rescue
    return false
  end
end

# Params
# obj<Class>:: class name
# number<String>:: the document number the kick
def kick_existing(obj, number)
  if existing = obj.find(:first, :params =>{ :filter=>{ :number => number } })
    existing.destroy
  end
end

def delete_test_data(doc, client)
  if doc.status !='draft'
    doc.status ='draft'
    doc.save
  end
  client.destroy
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sk_sdk-0.4.3 spec/resources_spec_helper.rb
sk_sdk-0.4.2 spec/resources_spec_helper.rb
sk_sdk-0.4.1 spec/resources_spec_helper.rb
sk_sdk-0.4.0 spec/resources_spec_helper.rb
sk_sdk-0.3.0 spec/resources_spec_helper.rb