Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
36d61b7
Merge pull request #1 from ignitionapp/add_connection
abreckner Apr 24, 2020
9655211
add Staff.list IGNT-3540 (#2)
bedrock-adam Apr 27, 2020
2c2f7db
Add VCR gem
abreckner Apr 27, 2020
941afae
VCR set up
abreckner Apr 27, 2020
e7d86f1
Add VCR test to staff list
abreckner Apr 27, 2020
5783fd5
Adding VCR instructions
abreckner Apr 27, 2020
5e054e0
read me updates
abreckner Apr 27, 2020
25b8d6f
update read me
abreckner Apr 27, 2020
a85851c
rubocop update
abreckner Apr 27, 2020
45e7f9f
Merge pull request #4 from ignitionapp/vcr-tests
abreckner Apr 27, 2020
757f96a
Remove gem versions and bundle update (for my gems)
abreckner Apr 27, 2020
564f42e
Adding ruby action
abreckner Apr 27, 2020
ae5fab0
rubocop fix
abreckner Apr 27, 2020
63a0e56
Merge pull request #8 from ignitionapp/abreckner-patch-1
abreckner Apr 27, 2020
0e8f1b5
Merge pull request #5 from ignitionapp/remove-gem-versions
abreckner Apr 27, 2020
acab3e5
Add template list (#9)
abreckner Apr 27, 2020
c687e21
Ignt 3563 job current (#11)
abreckner Apr 28, 2020
c06e506
Add Faraday post to connection and post test with VCR (#13)
abreckner Apr 28, 2020
a4bbf66
Refactor connection (#16)
abreckner Apr 28, 2020
95e2c46
Client.add (#14)
bedrock-adam Apr 28, 2020
40cab17
Use Oauth2 access_token and xero tenant id to instantiate connection …
abreckner Apr 29, 2020
f98ce8f
Remove staff model (#18)
abreckner Apr 29, 2020
546bb0d
remove faraday version (#20)
bedrock-adam Apr 29, 2020
a57ef38
Remove models (#19)
abreckner Apr 29, 2020
73ae8af
move duplication in services to Connection.get and Connection.post (#3)
bedrock-adam Apr 29, 2020
6306f4d
Add Dry Types gem and apply to Job.add (#21)
abreckner Apr 30, 2020
a2c8a2e
removing some code which is not used anymore (#22)
abreckner Apr 30, 2020
6da4a3d
Add dry types to client (and also refactored dry types on job) (#23)
abreckner Apr 30, 2020
f049eb4
Add back end code owners (#25)
abreckner May 1, 2020
fd89044
readme updates (#27)
abreckner May 1, 2020
90c2023
try again with original owners (#30)
abreckner May 1, 2020
dd9fea9
Staff.list - raise AccessToken exceptions (#24)
bedrock-adam May 3, 2020
2cf428c
Adding PUT to connection and testing it with Job.update (#32)
abreckner May 4, 2020
4ca01ec
Adding PR template (#34)
abreckner May 4, 2020
7ea3f04
Put job (part 2) (#33)
abreckner May 4, 2020
a6b9d29
Add DELETE to connection and test it with delete contact (#35)
abreckner May 4, 2020
eea0243
Client.update (#36)
bedrock-adam May 4, 2020
f6cc050
Add Job.get to api (#37)
abreckner May 5, 2020
f97bdc7
Client.list IGNT-3568 (#38)
bedrock-adam May 5, 2020
f2173ed
Add Job.state to API (#39)
abreckner May 5, 2020
9550603
Client::Contact.add IGNT-3571 (#40)
bedrock-adam May 5, 2020
03be55a
Client::Contact.update IGNT-3572 (#42)
bedrock-adam May 5, 2020
c140335
Connection error handling improvements (#41)
abreckner May 5, 2020
beadad9
finish PR (#43)
bedrock-adam May 5, 2020
a69ee21
Delete job with specs (#44)
abreckner May 5, 2020
cc01045
Client.list - add modified since and detailed specs IGNT-3631 (#45)
bedrock-adam May 6, 2020
06fb843
flatten contacts (#46)
bedrock-adam May 6, 2020
02908b4
Job assign (#47)
abreckner May 6, 2020
e284af3
Add applytemplate endpoint to Job (#48)
abreckner May 6, 2020
c539c2c
read me update (#49)
abreckner May 6, 2020
4831d54
Add RateLimitExceeded error class and raise them when we receive 429 …
rudylee Sep 30, 2020
e9a39d7
Merge pull request #50 from rudylee/add-rate-limit
rudylee Oct 14, 2020
6b1d547
Ensure that Staff#list and Template#list return an Array
rmustafin Oct 15, 2020
51cebae
Merge pull request #51 from ignitionapp/ramil/ensure_array
rmustafin Oct 15, 2020
82e7b24
allow the base url to be overwritten to query workflowmax where needed
whaluk Dec 1, 2020
f1c3125
Merge pull request #52 from ignitionapp/wfm-url-override
mehwoot Dec 3, 2020
5c62fcd
[FLOW-73] add Category
rmustafin Mar 7, 2021
7a7f078
cleanup
rmustafin Mar 7, 2021
9bd2ff3
cleanup
rmustafin Mar 8, 2021
e9b52b8
cleanup
rmustafin Mar 8, 2021
a1de80e
Merge pull request #54 from ignitionapp/FLOW-73/categories
rmustafin Mar 8, 2021
f2885e7
[NOJIRA] fix when API doesn't return an array for list methods
rmustafin Mar 17, 2021
6d7e20a
Merge pull request #55 from ignitionapp/NOJIRA/fix_empty_categoryes
rmustafin Mar 18, 2021
43066c4
Remove Job schema Description validation
rmustafin Apr 9, 2021
294ae1d
Merge pull request #58 from ignitionapp/ramil/rm_job_description_vali…
rmustafin Apr 12, 2021
e9308bc
Add update, delete and add methods to Staff
rmustafin Apr 16, 2021
570aa95
rubocop
rmustafin Apr 16, 2021
075b8fc
Merge pull request #59 from ignitionapp/ramil/staff_add__update_delete
rmustafin Apr 19, 2021
812107a
[FLOW-181] add details to RateLimitExceeded
rmustafin Jun 23, 2021
75f802a
cleanup
rmustafin Jun 23, 2021
f50b59d
rubocop
rmustafin Jun 23, 2021
43d5243
Merge pull request #60 from ignitionapp/FLOW-181/rate_limit_exceeded_…
rmustafin Jun 25, 2021
b3fe8cf
wrap Faraday::ConnectionFailed exception
rmustafin Jul 8, 2021
d206741
Merge pull request #61 from ignitionapp/ramil/raise_connection_failed
rmustafin Jul 9, 2021
5d3ce46
Add ConnectionTimeout error and raise it when we get Faraday::Timeout…
rudylee Jul 23, 2021
9f9b29f
raise NotAvailable exception (#64)
rmustafin Jul 26, 2021
3826796
Add faraday-encoding to correctly set the response body encoding (#65)
chrisrbnelson Aug 5, 2021
b93edb0
Unrestrict dry-types version and fix changes (#66)
chrisrbnelson Aug 6, 2021
1c088f3
Fix contacts array when creating or updating client (#67)
mehwoot Sep 6, 2021
1aa2512
Get a client (#68)
mehwoot Jan 24, 2022
457aaa9
Add specific errors to differentiate them (#69)
mehwoot Feb 8, 2022
7781c54
rm ClientID from job update schema (#53)
rmustafin Apr 7, 2022
f45d5db
Add Client GET /search action (#71)
davidevans-syd Jan 23, 2023
ee0753c
[RB-326] v31 client updates (#73)
rmustafin Apr 19, 2023
b780377
Add internal server error exception (#74)
rmustafin Nov 5, 2023
655e9f4
Remove isProspect from client.api schema (#75)
chrisrbnelson Aug 12, 2024
d5eb30a
Replaced token with a dummy string
pi-vikassaroha Jun 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/lib/ @ignitionapp/back-end
/spec/ @ignitionapp/back-end
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Intent (What)**

**Motivation (Why)**

**Implementation (How)**

**Consequence**
25 changes: 25 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Ruby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 3.1
uses: actions/setup-ruby@v1
with:
ruby-version: 3.1.x
- name: Build and test with Rake
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rubocop
bundle exec rake
27 changes: 8 additions & 19 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 3.1

Gemspec/OrderedDependencies:
Enabled: false
Expand Down Expand Up @@ -47,6 +47,9 @@ Layout/HeredocIndentation:
Layout/LeadingCommentSpace:
Enabled: true

Layout/LineLength:
Enabled: false

Layout/MultilineArrayBraceLayout:
Enabled: false

Expand Down Expand Up @@ -111,9 +114,6 @@ Metrics/PerceivedComplexity:
Enabled: true
Max: 10

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: true
Max: 50
Expand Down Expand Up @@ -159,18 +159,6 @@ Naming/MethodParameterName:
Naming/VariableNumber:
Enabled: false

Performance/Count:
Enabled: false

Performance/Casecmp:
Enabled: false

Performance/TimesMap:
Enabled: false

Performance/RegexpMatch:
Enabled: false

RSpec/AnyInstance:
Enabled: false

Expand Down Expand Up @@ -354,6 +342,7 @@ Style/GuardClause:
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys
EnforcedShorthandSyntax: never

Style/IfUnlessModifier:
Enabled: false
Expand Down Expand Up @@ -385,9 +374,6 @@ Style/MethodCallWithArgsParentheses:
- to
- not_to

Style/MethodMissingSuper:
Enabled: false

Style/MissingRespondToMissing:
Enabled: false

Expand Down Expand Up @@ -464,3 +450,6 @@ Style/SymbolProc:

Style/ZeroLengthPredicate:
Enabled: false

Style/MutableConstant:
Enabled: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
language: ruby
cache: bundler
rvm:
- 2.6.5
- 3.1.3
before_install: gem install bundler -v 2.1.4
142 changes: 107 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,57 +1,129 @@
PATH
remote: .
specs:
xpm_ruby (0.1.0)
xpm_ruby (0.4.0)
activesupport
builder
dry-types
faraday
faraday-encoding
ox (~> 2.13)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
diff-lcs (1.3)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
jaro_winkler (1.5.4)
multipart-post (2.1.1)
parallel (1.19.1)
parser (2.7.0.5)
ast (~> 2.4.0)
rainbow (3.0.0)
rake (13.0.1)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.1)
activesupport (7.1.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
ast (2.4.2)
base64 (0.1.1)
bigdecimal (3.1.4)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
drb (2.1.1)
ruby2_keywords
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.1)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
faraday (2.7.11)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-encoding (0.0.5)
faraday
faraday-net_http (3.0.2)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
method_source (1.0.0)
minitest (5.20.0)
mutex_m (0.1.2)
ox (2.14.17)
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.6.2)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.77.0)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.43.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 2.6)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.38.1)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
unicode-display_width (1.6.1)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-capybara (2.17.0)
rubocop (~> 1.41)
rubocop-rspec (2.18.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
vcr (6.1.0)
zeitwerk (2.6.12)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0)
rake (>= 12.3.3)
rspec (~> 3.0)
rubocop (= 0.77.0)
bundler
byebug (~> 11)
pry-byebug (~> 3)
rake
rspec
rubocop
rubocop-rspec
vcr
xpm_ruby!

BUNDLED WITH
Expand Down
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,67 @@
# XpmRuby

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xpm_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
This gem is used to access Xero's XPM api.

TODO: Delete this and the text above, and describe your gem
You will need to install and manage the access_tokens with Oauth 2.0 in your own app.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'xpm_ruby'
gem "xpm_ruby", git: "https://github.com/ignitionapp/xpm_ruby"
```

And then execute:

$ bundle install

Or install it yourself as:
## Usage

$ gem install xpm_ruby
Most of the API calls will require at least the two main following arguments

## Usage
1. `access_token` - the oauth2 access token (Oauth2 is not included here)
1. `xero_tenant_id` - You get this by calling the xero api connection. See https://github.com/ignitionapp/xpm_ruby_demo/blob/master/subdomains/xpm_integration/access_token.rb for more details.

Handling the refresh token and logging into Xero should all take place in the main app. The sample app is available at https://github.com/ignitionapp/xpm_ruby_demo

Most of the time, you will be passing in a hash representation of the object you are working with (with one or two exceptions where it might be an ID or raw XML).

The gem will convert the hash into the XML needed by the XPM api. The data that is returned will automatically be converted from XML to a Ruby Hash or Array.

For example, a call to `XPMRuby::Staff.list(access_token: access_token, xero_tenant_id: xero_tenant_id)` will return an array of hashes representing the staff list.

```ruby
[
{ "ID" => "859230", "Name" => "Dev Testing", "Email" => "dev@practiceignition.com", "Phone" => nil, "Mobile" => nil, "Address" => nil, "PayrollCode" => nil },
...
]
```

TODO: Write usage instructions here
As much as possible, we have tried to keep to the same names as documented here: https://developer.xero.com/documentation/practice-manager/overview-practice-manager-api however we have not as yet added the full API (only the endpoints we are currently using in ignitionapp).

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
TODO set up this gem to release automatically when merged into master...

Note: This gem is not released yet and is currently for internal use.

Please refer to it via github for now
e.g.
`gem "xpm_ruby", git: "https://github.com/ignitionapp/xpm_ruby"`

## Testing
Rspec is used for testing

`bundle exec rspec`

In addition, rubocop is installed to check formatting and code quality

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
`bundle exec rubocop`

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xpm_ruby.
Bug reports and pull requests are welcome on GitHub at https://github.com/ignitionapp/xpm_ruby.


## License
Expand Down
Loading
Loading