Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 39c7aed

Browse files
committed
Merge pull request #1 from Sage/add_travis
add Travis CI
2 parents 749ef2b + 61c5bdd commit 39c7aed

20 files changed

+81
-5
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: ruby
2+
rvm:
3+
- 2.3.0
4+
- 2.2.4
5+
- 2.2.3
6+
- 2.2.1
7+
- 2.2.0
8+
- 2.1.8
9+
- 2.1.7
10+
- 2.1.6
11+
- 2.1.5
12+
- 2.1.4
13+
- 2.1.3
14+
- 2.1.1
15+
- 2.0.0

Fudgefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
task_group :spec do
2+
rspec :coverage => 80
3+
end
4+
5+
task_group :docs do
6+
task :yard, :coverage => 68
7+
end
8+
9+
task_group :codestyle do
10+
task :cane, :max_width => 120
11+
end
12+
13+
task_group :duplication do
14+
task :flay, :exclude => '^\.\/spec\/'
15+
end
16+
17+
task_group :complexity do
18+
task :flog, :exclude => '^\.\/spec\/', :methods => true
19+
end
20+
21+
build :default do
22+
task_group :docs
23+
task_group :codestyle
24+
task_group :complexity
25+
task_group :duplication
26+
task_group :spec
27+
end

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# SageoneSdk
22

3+
[![Build Status](https://travis-ci.org/Sage/sageone_api_ruby_sdk.svg?branch=master)](https://travis-ci.org/Sage/sageone_api_ruby_sdk)
4+
35
The `sageone_sdk` gem provides Ruby methods for accessing the Sage One API endpoints.
46

57
## Installation

Rakefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
require "bundler/gem_tasks"
1+
require 'bundler/gem_tasks'
2+
require 'rspec/core/rake_task'
3+
RSpec::Core::RakeTask.new(:spec)
24

5+
task :default => :fudge
6+
7+
# Test Fudge using Fudge
8+
task :fudge do
9+
exec 'fudge build 2> /dev/null'
10+
end

fudge_settings.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
flay:
2+
max: 498
3+
flog:
4+
max: 28
5+
average: 5.5

lib/sageone_sdk.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "sageone_sdk/client"
22
require "sageone_sdk/default"
3-
3+
# SageoneSdk
44
module SageoneSdk
55
autoload :SDataResponse, "sageone_sdk/sdata_response"
66
class << self

lib/sageone_sdk/authentication.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module SageoneSdk
2+
# Authentication
23
module Authentication
34
def token_authenticated?
45
!!@access_token

lib/sageone_sdk/client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
require "sageone_sdk/client/transactions"
2929

3030
module SageoneSdk
31+
# Client
3132
class Client
3233
include SageoneSdk::Authentication
3334
include SageoneSdk::Configurable

lib/sageone_sdk/client/chart_of_accounts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module SageoneSdk
22
class Client
33

4-
# Represents the chart of accounts. This is a list
4+
# Represents the chart of accounts. This is a list
55
# of all of the accounts used by your business. It defines the structure
66
# of your income, expenditure, assets, liabilities and capital when
77
# running your management reports.

lib/sageone_sdk/client/expenditures.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module SageoneSdk
22
class Client
3+
# Expenditures
34
module Expenditures
45
def expenditures(options = {})
56
paginate "expenditures", options

lib/sageone_sdk/configurable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module SageoneSdk
2+
# Configurable
23
module Configurable
34
attr_accessor :access_token, :connection_options, :default_media_type, :user_agent, :signing_secret
45

lib/sageone_sdk/default.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require 'sageone_sdk/version'
22

33
module SageoneSdk
4+
# Default
45
module Default
56
ACCESS_TOKEN = "default_access_token"
67
SIGNING_SECRET = "default_signing_secret"

lib/sageone_sdk/middleware/sdata_parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
module SageoneSdk
88
module Middleware
9+
# Sdata parser
910
class SDataParser < Faraday::Middleware
1011
def call(environment)
1112
@app.call(environment).on_complete do |env|

lib/sageone_sdk/middleware/signature.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
module SageoneSdk
55
module Middleware
6+
# Signature
67
class Signature < Faraday::Middleware
78
def initialize(app, access_token, signing_secret)
89
super(app)

lib/sageone_sdk/sdata_error_response.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module SageoneSdk
2+
# SData error response
23
class SDataErrorResponse
34
attr_reader :data
45

lib/sageone_sdk/sdata_response.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module SageoneSdk
2+
# SData response
23
class SDataResponse
34
attr_reader :data
45

lib/sageone_sdk/signature.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'cgi'
44

55
module SageoneSdk
6+
# Signature
67
class Signature
78
attr_reader :http_method, :nonce
89

sageone_sdk.gemspec

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,13 @@ Gem::Specification.new do |spec|
2626

2727
spec.add_development_dependency "bundler", "~> 1.7"
2828
spec.add_development_dependency "rake", "~> 10.0"
29+
spec.add_development_dependency 'cane'
30+
spec.add_development_dependency 'flay'
31+
spec.add_development_dependency 'flog'
32+
spec.add_development_dependency 'fudge'
33+
spec.add_development_dependency 'guard-rspec'
34+
spec.add_development_dependency 'rake'
35+
spec.add_development_dependency 'rspec'
36+
spec.add_development_dependency 'simplecov'
37+
spec.add_development_dependency 'yard'
2938
end
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"http_interactions":[{"request":{"method":"get","uri":"https://api.sageone.com/accounts/v1/ledger_accounts/7686","body":{"encoding":"US-ASCII","string":""},"headers":{"Accept":["application/json"],"Content-Type":["application/x-www-form-urlencoded"],"User-Agent":["Sage One Ruby Gem 0.0.1"],"Authorization":["Bearer \u003CACCESS_TOKEN\u003E"],"X-Nonce":["d173e55f52f91b951d9ccb2bbebcc124"],"X-Signature":["GW5iI+Fjnp+c7b/6qKWvQGrzumY="],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["must-revalidate, private, max-age=0"],"Content-Type":["application/json;vnd.sage=sdata"],"Date":["Wed, 31 Dec 2014 11:49:17 GMT"],"Etag":["\"48ab5784e043cfce44d4c1bde3fc0fd7\""],"Server":["openresty"],"Status":["200"],"Vary":["Accept-Encoding"],"X-Rack-Cache":["miss"],"X-Request-Id":["2656c17b7b126041d2e902873c2ad4ba"],"X-Runtime":["0.061587"],"X-Server":["accounts.sageone.com (uat)"],"X-Ua-Compatible":["IE=Edge,chrome=1"],"Content-Length":["298"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"{\"id\":7686,\"included_in_chart\":true,\"ledger_name\":\"Office equipment and IT - Cost\",\"name\":\"IT equipment cost\",\"nominal_code\":30,\"last_updated\":\"2014-12-31T10:03:43+00:00\",\"tax_code\":{\"id\":1,\"name\":\"STANDARD\",\"$key\":1},\"category\":{\"id\":7,\"name\":\"Fixed Assets\",\"$key\":7},\"category_group\":{\"id\":7,\"name\":\"Asset\",\"$key\":7},\"is_bank_account\":false,\"coa_account\":{\"id\":9,\"included_in_chart\":true,\"ledger_name\":\"Office equipment and IT - Cost\",\"display_name\":\"IT equipment cost\",\"nominal_code\":30,\"control_name\":null,\"last_updated\":\"2010-06-29T14:52:41+01:00\",\"category\":{\"id\":7,\"name\":\"Fixed Assets\",\"$key\":7},\"category_group\":{\"id\":7,\"name\":\"Asset\",\"$key\":7},\"$key\":9},\"$key\":7686}"},"http_version":null},"recorded_at":"Wed, 31 Dec 2014 11:49:17 GMT"}],"recorded_with":"VCR 2.9.3"}
1+
{"http_interactions":[{"request":{"method":"get","uri":"https://api.sageone.com/accounts/v1/ledger_accounts/7686","body":{"encoding":"US-ASCII","string":""},"headers":{"Accept":["application/json"],"Content-Type":["application/x-www-form-urlencoded"],"User-Agent":["Sage One Ruby Gem 0.0.1"],"Authorization":["Bearer \u003CACCESS_TOKEN\u003E"],"X-Nonce":["d173e55f52f91b951d9ccb2bbebcc124"],"X-Signature":["GW5iI+Fjnp+c7b/6qKWvQGrzumY="],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["must-revalidate, private, max-age=0"],"Content-Type":["application/json;vnd.sage=sdata"],"Date":["Wed, 31 Dec 2014 11:49:17 GMT"],"Etag":["\"48ab5784e043cfce44d4c1bde3fc0fd7\""],"Server":["openresty"],"Status":["200"],"Vary":["Accept-Encoding"],"X-Rack-Cache":["miss"],"X-Request-Id":["2656c17b7b126041d2e902873c2ad4ba"],"X-Runtime":["0.061587"],"X-Server":["accounts.sageone.com (uat)"],"X-Ua-Compatible":["IE=Edge,chrome=1"],"Content-Length":["298"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"{\"id\":7686,\"included_in_chart\":true,\"ledger_name\":\"Office equipment and IT - Cost\",\"name\":\"IT equipment cost\",\"nominal_code\":30,\"last_updated\":\"2014-12-31T10:03:43+00:00\",\"tax_code\":{\"id\":1,\"name\":\"STANDARD\",\"$key\":1},\"category\":{\"id\":7,\"name\":\"Fixed Assets\",\"$key\":7},\"category_group\":{\"id\":7,\"name\":\"Asset\",\"$key\":7},\"is_bank_account\":false,\"coa_account\":{\"id\":9,\"included_in_chart\":true,\"ledger_name\":\"Office equipment and IT - Cost\",\"display_name\":\"IT equipment cost\",\"nominal_code\":30,\"control_name\":null,\"last_updated\":\"2010-06-29T14:52:41+01:00\",\"category\":{\"id\":7,\"name\":\"Fixed Assets\",\"$key\":7},\"category_group\":{\"id\":7,\"name\":\"Asset\",\"$key\":7},\"$key\":9},\"$key\":7686}"},"http_version":null},"recorded_at":"Wed, 31 Dec 2014 11:49:17 GMT"}],"recorded_with":"VCR 2.9.3"}

spec/sageone_sdk/client/journals_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"journal_lines[1][details]" => "detail",
2222
"journal_lines[1][ledger_account][nominal_code]" => 9999}
2323
end
24-
24+
2525
it "creates a journal" do
2626
journal = client.create_journal(data)
2727
expect(journal.reference).not_to be_nil

0 commit comments

Comments
 (0)