Commit 51fb557948d4c8a25381820c4773b1e12e77a101
1 parent
87fd11a1
add client test, add syspro client class, add faraday, cop some stripe stuff
Showing
6 changed files
with
74 additions
and
5 deletions
Show diff stats
| 1 | +PATH | ||
| 2 | + remote: . | ||
| 3 | + specs: | ||
| 4 | + syspro (0.1.0) | ||
| 5 | + faraday (~> 0.10) | ||
| 6 | + | ||
| 7 | +GEM | ||
| 8 | + remote: https://rubygems.org/ | ||
| 9 | + specs: | ||
| 10 | + faraday (0.14.0) | ||
| 11 | + multipart-post (>= 1.2, < 3) | ||
| 12 | + minitest (5.11.3) | ||
| 13 | + multipart-post (2.0.0) | ||
| 14 | + rake (10.5.0) | ||
| 15 | + | ||
| 16 | +PLATFORMS | ||
| 17 | + ruby | ||
| 18 | + | ||
| 19 | +DEPENDENCIES | ||
| 20 | + bundler (~> 1.16) | ||
| 21 | + minitest (~> 5.0) | ||
| 22 | + rake (~> 10.0) | ||
| 23 | + syspro! | ||
| 24 | + | ||
| 25 | +BUNDLED WITH | ||
| 26 | + 1.16.1 |
lib/syspro.rb
| 1 | +require "cgi" | ||
| 2 | +require "faraday" | ||
| 3 | +require "json" | ||
| 4 | +require "logger" | ||
| 5 | +require "openssl" | ||
| 6 | + | ||
| 1 | require "syspro/version" | 7 | require "syspro/version" |
| 8 | +require "syspro/syspro_client" | ||
| 2 | 9 | ||
| 3 | module Syspro | 10 | module Syspro |
| 4 | # Your code goes here... | 11 | # Your code goes here... |
| 12 | + # | ||
| 13 | + | ||
| 14 | + def self.ca_store | ||
| 15 | + @ca_store ||= begin | ||
| 16 | + store = OpenSSL::X509::Store.new | ||
| 17 | + store.add_file(ca_bundle_path) | ||
| 18 | + store | ||
| 19 | + end | ||
| 20 | + end | ||
| 5 | end | 21 | end |
| 1 | +module Syspro | ||
| 2 | + class SysproClient | ||
| 3 | + def initialize(conn = nil) | ||
| 4 | + self.conn = conn || self.class.default_conn | ||
| 5 | + @system_profiler = SystemProfiler.new | ||
| 6 | + end | ||
| 7 | + | ||
| 8 | + def self.active_client | ||
| 9 | + Thread.current[:syspro_client] || default_client | ||
| 10 | + end | ||
| 11 | + | ||
| 12 | + def self.default_client | ||
| 13 | + Thread.current[:syspro_client_default_client] ||= SysproClient.new(default_conn) | ||
| 14 | + end | ||
| 15 | + | ||
| 16 | + def get_syspro_version | ||
| 17 | + | ||
| 18 | + end | ||
| 19 | + end | ||
| 20 | +end | ||
| 21 | + |
syspro.gemspec
| @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| | @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| | ||
| 8 | spec.authors = ["Isaac Lewis"] | 8 | spec.authors = ["Isaac Lewis"] |
| 9 | spec.email = ["ike@wild.land"] | 9 | spec.email = ["ike@wild.land"] |
| 10 | 10 | ||
| 11 | - spec.summary = %q{Connection library for SYSPRO 7 API} | 11 | + spec.summary = %q{SYSPRO 7 Api Ruby adapter} |
| 12 | spec.license = "MIT" | 12 | spec.license = "MIT" |
| 13 | 13 | ||
| 14 | # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' | 14 | # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' |
| @@ -27,6 +27,8 @@ Gem::Specification.new do |spec| | @@ -27,6 +27,8 @@ Gem::Specification.new do |spec| | ||
| 27 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | 27 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } |
| 28 | spec.require_paths = ["lib"] | 28 | spec.require_paths = ["lib"] |
| 29 | 29 | ||
| 30 | + spec.add_dependency("faraday", "~> 0.10") | ||
| 31 | + | ||
| 30 | spec.add_development_dependency "bundler", "~> 1.16" | 32 | spec.add_development_dependency "bundler", "~> 1.16" |
| 31 | spec.add_development_dependency "rake", "~> 10.0" | 33 | spec.add_development_dependency "rake", "~> 10.0" |
| 32 | spec.add_development_dependency "minitest", "~> 5.0" | 34 | spec.add_development_dependency "minitest", "~> 5.0" |
test/syspro_test.rb
| @@ -4,8 +4,4 @@ class SysproTest < Minitest::Test | @@ -4,8 +4,4 @@ class SysproTest < Minitest::Test | ||
| 4 | def test_that_it_has_a_version_number | 4 | def test_that_it_has_a_version_number |
| 5 | refute_nil ::Syspro::VERSION | 5 | refute_nil ::Syspro::VERSION |
| 6 | end | 6 | end |
| 7 | - | ||
| 8 | - def test_it_does_something_useful | ||
| 9 | - assert false | ||
| 10 | - end | ||
| 11 | end | 7 | end |