From 9655211ed0a4752d21e701d6f1be0566a1f4ec3b Mon Sep 17 00:00:00 2001 From: Adam Mikulasev Date: Mon, 27 Apr 2020 11:18:21 +1000 Subject: [PATCH 01/74] add Staff.list IGNT-3540 (#2) * add Staff.list * fix model namespace * remove extra line * drop sax parser * remove parser spec * optimise * fix payroll_code * add dry typesa * Revert "add dry typesa" This reverts commit 05de0bcc6e5d8e1fab952c7cd1d477f73520be97. * superclass errors + add api_url * update to use Connection --- Gemfile.lock | 15 ++++++++++- lib/xpm_ruby.rb | 10 ++++---- lib/xpm_ruby/models/staff.rb | 26 +++++++++++++++++++ lib/xpm_ruby/staff.rb | 48 ++++++++++++++++++++++++++++++++++++ spec/staff_spec.rb | 35 ++++++++++++++++++++++++++ xpm_ruby.gemspec | 6 ++++- 6 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 lib/xpm_ruby/models/staff.rb create mode 100644 lib/xpm_ruby/staff.rb create mode 100644 spec/staff_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index a610b53..bdeb076 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,20 +2,31 @@ PATH remote: . specs: xpm_ruby (0.1.0) - faraday + faraday (~> 1) + ox (~> 2.13) GEM remote: https://rubygems.org/ specs: ast (2.4.0) + byebug (11.1.3) + coderay (1.1.2) diff-lcs (1.3) faraday (1.0.1) multipart-post (>= 1.2, < 3) jaro_winkler (1.5.4) + method_source (1.0.0) multipart-post (2.1.1) + ox (2.13.2) parallel (1.19.1) parser (2.7.0.5) ast (~> 2.4.0) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) rainbow (3.0.0) rake (13.0.1) rspec (3.9.0) @@ -48,6 +59,8 @@ PLATFORMS DEPENDENCIES bundler (~> 2.0) + byebug (~> 11) + pry-byebug (~> 3) rake (>= 12.3.3) rspec (~> 3.0) rubocop (= 0.77.0) diff --git a/lib/xpm_ruby.rb b/lib/xpm_ruby.rb index 4808228..edeb489 100644 --- a/lib/xpm_ruby.rb +++ b/lib/xpm_ruby.rb @@ -1,8 +1,8 @@ -require "xpm_ruby/version" - -require "xpm_ruby/connection" - module XpmRuby class Error < StandardError; end - # Your code goes here... + class Unauthorized < Error; end end + +require "xpm_ruby/version" +require "xpm_ruby/connection" +require "xpm_ruby/staff" diff --git a/lib/xpm_ruby/models/staff.rb b/lib/xpm_ruby/models/staff.rb new file mode 100644 index 0000000..32a3bf9 --- /dev/null +++ b/lib/xpm_ruby/models/staff.rb @@ -0,0 +1,26 @@ +module XpmRuby + module Models + class Staff + attr_accessor :uuid, :name, :email, :phone, :mobile, :address, :payroll_code + + def initialize(uuid: nil, name: nil, email: nil, phone: nil, mobile: nil, + address: nil, payroll_code: nil) + @uuid = uuid + @name = name + @email = email + @phone = phone + @mobile = mobile + @address = address + @payroll_code = payroll_code + end + + def ==(other) + uuid == other.uuid + end + + def eql?(other) + self == other + end + end + end +end diff --git a/lib/xpm_ruby/staff.rb b/lib/xpm_ruby/staff.rb new file mode 100644 index 0000000..0084f6f --- /dev/null +++ b/lib/xpm_ruby/staff.rb @@ -0,0 +1,48 @@ +require "ox" + +require_relative "models/staff" + +module XpmRuby + module Staff + extend self + + class Error < Error; end + + def build(**args) + Models::Staff.new(args) + end + + def list(api_key:, account_key:, api_url:) + response = Connection + .new(api_key: api_key, account_key: account_key, api_url: api_url) + .get(endpoint: "staff.api/list") + + case response.status + when 401 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + raise Unauthorized.new(hash["html"]["head"]["title"]) + when 200 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + case hash["Response"]["Status"] + when "OK" + hash["Response"]["StaffList"]["Staff"].map do |staff| + Models::Staff.new( + uuid: staff["UUID"], + name: staff["Name"], + email: staff["Email"], + phone: staff["Phone"], + mobile: staff["Mobile"], + address: staff["Address"], + payroll_code: staff["PayrollCode"]) + end + when "ERROR" + raise Error.new(response["ErrorDescription"]) + end + else + raise Error.new(response.status) + end + end + end +end diff --git a/spec/staff_spec.rb b/spec/staff_spec.rb new file mode 100644 index 0000000..81a702b --- /dev/null +++ b/spec/staff_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +module XpmRuby + RSpec.describe(Staff) do + describe ".list" do + context "when keys invalid" do + let(:api_key) { "" } + let(:account_key) { "" } + let(:api_url) { "api.workflowmax.com" } + + xit "raises unauthorized error" do + expect do + Staff.list(api_key: api_key, account_key: account_key, api_url: api_url) + end.to raise_error(Unauthorized) + end + end + + context "when keys valid" do + let(:api_key) { "" } + let(:account_key) { "" } + let(:api_url) { "api.workflowmax.com" } + + xit "lists staff" do + expect( + Staff.list(api_key: api_key, account_key: account_key, api_url: api_url) + ).to include( + Staff.build( + name: "Dev Testing", + email: "dev@practiceignition.com", + uuid: "8c79202e-caf8-4a12-a3d7-ac338e50741f")) + end + end + end + end +end diff --git a/xpm_ruby.gemspec b/xpm_ruby.gemspec index 26bc43d..569b56e 100644 --- a/xpm_ruby.gemspec +++ b/xpm_ruby.gemspec @@ -32,5 +32,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency("rubocop", "0.77.0") spec.add_development_dependency("rubocop-rspec") - spec.add_runtime_dependency("faraday") + spec.add_development_dependency("byebug", "~> 11") + spec.add_development_dependency("pry-byebug", "~> 3") + + spec.add_runtime_dependency("faraday", "~> 1") + spec.add_runtime_dependency("ox", "~> 2.13") end From 2c2f7dbf3e1f05f320adf95843ca64dd7798313d Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 11:23:18 +1000 Subject: [PATCH 02/74] Add VCR gem --- Gemfile.lock | 2 ++ xpm_ruby.gemspec | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index bdeb076..b97ffe8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,6 +53,7 @@ GEM rubocop (>= 0.68.1) ruby-progressbar (1.10.1) unicode-display_width (1.6.1) + vcr (5.1.0) PLATFORMS ruby @@ -65,6 +66,7 @@ DEPENDENCIES rspec (~> 3.0) rubocop (= 0.77.0) rubocop-rspec + vcr xpm_ruby! BUNDLED WITH diff --git a/xpm_ruby.gemspec b/xpm_ruby.gemspec index 569b56e..7365b44 100644 --- a/xpm_ruby.gemspec +++ b/xpm_ruby.gemspec @@ -37,4 +37,6 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency("faraday", "~> 1") spec.add_runtime_dependency("ox", "~> 2.13") + + spec.add_development_dependency("vcr") end From 941afaeb727d678f40cd8d67ac93cac3ac6b67f0 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:24:11 +1000 Subject: [PATCH 03/74] VCR set up --- spec/spec_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 008a1cf..a9d2e98 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ require "bundler/setup" require "xpm_ruby" +require "vcr" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure @@ -12,3 +13,10 @@ c.syntax = :expect end end + +VCR.configure do |config| + config.default_cassette_options = { record: :new_episodes } + + config.cassette_library_dir = "spec/vcr_cassettes" + config.hook_into(:faraday) +end From e7d86f1530448b45f162179aafc7cc6751e91a03 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:24:35 +1000 Subject: [PATCH 04/74] Add VCR test to staff list --- spec/staff_spec.rb | 35 ----------------- spec/vcr_cassettes/xpm_ruby/staff/list.yml | 44 ++++++++++++++++++++++ spec/xpm_ruby/staff_spec.rb | 42 +++++++++++++++++++++ 3 files changed, 86 insertions(+), 35 deletions(-) delete mode 100644 spec/staff_spec.rb create mode 100644 spec/vcr_cassettes/xpm_ruby/staff/list.yml create mode 100644 spec/xpm_ruby/staff_spec.rb diff --git a/spec/staff_spec.rb b/spec/staff_spec.rb deleted file mode 100644 index 81a702b..0000000 --- a/spec/staff_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -module XpmRuby - RSpec.describe(Staff) do - describe ".list" do - context "when keys invalid" do - let(:api_key) { "" } - let(:account_key) { "" } - let(:api_url) { "api.workflowmax.com" } - - xit "raises unauthorized error" do - expect do - Staff.list(api_key: api_key, account_key: account_key, api_url: api_url) - end.to raise_error(Unauthorized) - end - end - - context "when keys valid" do - let(:api_key) { "" } - let(:account_key) { "" } - let(:api_url) { "api.workflowmax.com" } - - xit "lists staff" do - expect( - Staff.list(api_key: api_key, account_key: account_key, api_url: api_url) - ).to include( - Staff.build( - name: "Dev Testing", - email: "dev@practiceignition.com", - uuid: "8c79202e-caf8-4a12-a3d7-ac338e50741f")) - end - end - end - end -end diff --git a/spec/vcr_cassettes/xpm_ruby/staff/list.yml b/spec/vcr_cassettes/xpm_ruby/staff/list.yml new file mode 100644 index 0000000..51ec1ce --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/staff/list.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.workflowmax.com/v3/staff.api/list + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic TEST + User-Agent: + - Faraday v1.0.1 + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:07:18 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '369' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OKaa93a24c-0633-4885-b104-7b4e43cc702eJane Doejane@test.com
1cc99c1e-8cf7-4248-ab84-3e11126facbcJohn Doejohn@test.com
+ http_version: null + recorded_at: Mon, 27 Apr 2020 02:07:19 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/staff_spec.rb b/spec/xpm_ruby/staff_spec.rb new file mode 100644 index 0000000..07568ad --- /dev/null +++ b/spec/xpm_ruby/staff_spec.rb @@ -0,0 +1,42 @@ +require "spec_helper" + +module XpmRuby + RSpec.describe(Staff) do + subject(:service) { described_class } + describe ".list" do + context "when keys invalid" do + let(:api_key) { "" } + let(:account_key) { "" } + let(:api_url) { "api.workflowmax.com" } + + xit "raises unauthorized error" do + expect do + Staff.list(api_key: api_key, account_key: account_key, api_url: api_url) + end.to raise_error(Unauthorized) + end + end + + context "when keys valid" do + let(:api_key) { "TEST" } + let(:account_key) { "TEST" } + let(:api_url) { "api.workflowmax.com" } + + around(:each) do |example| + VCR.use_cassette("xpm_ruby/staff/list") do + example.run + end + end + + it "lists staff" do + staff_list = service.list(api_key: api_key, account_key: account_key, api_url: api_url) + + staff = staff_list.last + + expect(staff.name).to eql("John Doe") + expect(staff.email).to eql("john@test.com") + expect(staff.uuid).to eql("1cc99c1e-8cf7-4248-ab84-3e11126facbc") + end + end + end + end +end From 5783fd5cf5967a8766ae4dbcf085f97f77598f63 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:29:01 +1000 Subject: [PATCH 05/74] Adding VCR instructions --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index d1f489a..303f1bb 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,20 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run 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). +## Testing + +### Testing with VCR +There are a few extra steps you need when writing VCR spec to avoid checking in sensitive data. +1. When writing a new VCR spec, you need to use the real api_key and account_key to hit the server +1. After you have generated the spec, change the api_key and account_key BEFORE CHECKING IT IN +1. Open up the cassette and ensure you have updated the Basic auth code as well (also before checking it in) +``` +headers: + Authorization: + - Basic TEST +``` +1. If needed you can also alter the body.string of the response + ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/xpm_ruby. From 5e054e01bbf279bddace9bb6e68b73ffc13af1da Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:32:26 +1000 Subject: [PATCH 06/74] read me updates --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 303f1bb..8f40f29 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ### Testing with VCR There are a few extra steps you need when writing VCR spec to avoid checking in sensitive data. -1. When writing a new VCR spec, you need to use the real api_key and account_key to hit the server -1. After you have generated the spec, change the api_key and account_key BEFORE CHECKING IT IN +1. When writing a new VCR spec, you need to use the real api_key and account_key initially to hit the server +1. After you have generated the cassette, change the api_key and account_key in your spec BEFORE CHECKING IT IN 1. Open up the cassette and ensure you have updated the Basic auth code as well (also before checking it in) ``` headers: From 25b8d6f94a15ea852cdfcb3126b4878179b94d96 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:33:36 +1000 Subject: [PATCH 07/74] update read me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f40f29..dfc8de1 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To There are a few extra steps you need when writing VCR spec to avoid checking in sensitive data. 1. When writing a new VCR spec, you need to use the real api_key and account_key initially to hit the server 1. After you have generated the cassette, change the api_key and account_key in your spec BEFORE CHECKING IT IN -1. Open up the cassette and ensure you have updated the Basic auth code as well (also before checking it in) +1. Open up the cassette and ensure you have updated the Basic auth code as well (also before checking it in) as you can extrapolate the account and api keys from this. ``` headers: Authorization: From a85851ca08f82b288fbed1ad480c64f6b127e2b0 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 12:35:01 +1000 Subject: [PATCH 08/74] rubocop update --- spec/xpm_ruby/staff_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/xpm_ruby/staff_spec.rb b/spec/xpm_ruby/staff_spec.rb index 07568ad..b6b8d93 100644 --- a/spec/xpm_ruby/staff_spec.rb +++ b/spec/xpm_ruby/staff_spec.rb @@ -3,6 +3,7 @@ module XpmRuby RSpec.describe(Staff) do subject(:service) { described_class } + describe ".list" do context "when keys invalid" do let(:api_key) { "" } From 757f96a0992bb439b3e4093789c53de2703ffd7a Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 13:00:03 +1000 Subject: [PATCH 09/74] Remove gem versions and bundle update (for my gems) --- .rubocop.yml | 18 +++--------------- Gemfile.lock | 20 +++++++++++--------- xpm_ruby.gemspec | 8 ++++---- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4414801..adfe750 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -47,6 +47,9 @@ Layout/HeredocIndentation: Layout/LeadingCommentSpace: Enabled: true +Layout/LineLength: + Enabled: false + Layout/MultilineArrayBraceLayout: Enabled: false @@ -111,9 +114,6 @@ Metrics/PerceivedComplexity: Enabled: true Max: 10 -Metrics/LineLength: - Enabled: false - Metrics/MethodLength: Enabled: true Max: 50 @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index b97ffe8..1e675d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GEM multipart-post (2.1.1) ox (2.13.2) parallel (1.19.1) - parser (2.7.0.5) + parser (2.7.1.1) ast (~> 2.4.0) pry (0.13.1) coderay (~> 1.1) @@ -29,6 +29,7 @@ GEM pry (~> 0.13.0) rainbow (3.0.0) rake (13.0.1) + rexml (3.2.4) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -42,29 +43,30 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.2) - rubocop (0.77.0) + rubocop (0.82.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) + unicode-display_width (>= 1.4.0, < 2.0) rubocop-rspec (1.38.1) rubocop (>= 0.68.1) ruby-progressbar (1.10.1) - unicode-display_width (1.6.1) + unicode-display_width (1.7.0) vcr (5.1.0) PLATFORMS ruby DEPENDENCIES - bundler (~> 2.0) + bundler byebug (~> 11) pry-byebug (~> 3) - rake (>= 12.3.3) - rspec (~> 3.0) - rubocop (= 0.77.0) + rake + rspec + rubocop rubocop-rspec vcr xpm_ruby! diff --git a/xpm_ruby.gemspec b/xpm_ruby.gemspec index 7365b44..a8ea1c9 100644 --- a/xpm_ruby.gemspec +++ b/xpm_ruby.gemspec @@ -25,11 +25,11 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_development_dependency("bundler", "~> 2.0") - spec.add_development_dependency("rake", ">= 12.3.3") - spec.add_development_dependency("rspec", "~> 3.0") + spec.add_development_dependency("bundler") + spec.add_development_dependency("rake") + spec.add_development_dependency("rspec") - spec.add_development_dependency("rubocop", "0.77.0") + spec.add_development_dependency("rubocop") spec.add_development_dependency("rubocop-rspec") spec.add_development_dependency("byebug", "~> 11") From 564f42ec4d049fe3ca6dda45cbd8cd7f16967019 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 15:15:43 +1000 Subject: [PATCH 10/74] Adding ruby action --- .github/workflows/ruby.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..ca81818 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -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 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Build and test with Rake + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + bundle exec rubocop + bundle exec rake From ae5fab0e450ba2a404d92a2eab934a479d88f343 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 15:19:13 +1000 Subject: [PATCH 11/74] rubocop fix --- spec/xpm_ruby_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/xpm_ruby_spec.rb b/spec/xpm_ruby_spec.rb index 7eee8e5..17a71b5 100644 --- a/spec/xpm_ruby_spec.rb +++ b/spec/xpm_ruby_spec.rb @@ -2,8 +2,4 @@ it "has a version number" do expect(XpmRuby::VERSION).not_to be(nil) end - - it "does something useful" do - expect(true).to eq(true) - end end From acab3e5259a7e18d020a1bf1ca2ca489b08aa688 Mon Sep 17 00:00:00 2001 From: abreckner Date: Mon, 27 Apr 2020 16:10:56 +1000 Subject: [PATCH 12/74] Add template list (#9) --- lib/xpm_ruby.rb | 1 + lib/xpm_ruby/models/template.rb | 20 +++++++ lib/xpm_ruby/template.rb | 43 +++++++++++++++ spec/vcr_cassettes/xpm_ruby/template/list.yml | 54 +++++++++++++++++++ spec/xpm_ruby/template_spec.rb | 30 +++++++++++ 5 files changed, 148 insertions(+) create mode 100644 lib/xpm_ruby/models/template.rb create mode 100644 lib/xpm_ruby/template.rb create mode 100644 spec/vcr_cassettes/xpm_ruby/template/list.yml create mode 100644 spec/xpm_ruby/template_spec.rb diff --git a/lib/xpm_ruby.rb b/lib/xpm_ruby.rb index edeb489..a3f997f 100644 --- a/lib/xpm_ruby.rb +++ b/lib/xpm_ruby.rb @@ -6,3 +6,4 @@ class Unauthorized < Error; end require "xpm_ruby/version" require "xpm_ruby/connection" require "xpm_ruby/staff" +require "xpm_ruby/template" diff --git a/lib/xpm_ruby/models/template.rb b/lib/xpm_ruby/models/template.rb new file mode 100644 index 0000000..c196a7d --- /dev/null +++ b/lib/xpm_ruby/models/template.rb @@ -0,0 +1,20 @@ +module XpmRuby + module Models + class Template + attr_accessor :uuid, :name + + def initialize(uuid: nil, name: nil) + @uuid = uuid + @name = name + end + + def ==(other) + uuid == other.uuid + end + + def eql?(other) + self == other + end + end + end +end diff --git a/lib/xpm_ruby/template.rb b/lib/xpm_ruby/template.rb new file mode 100644 index 0000000..4500146 --- /dev/null +++ b/lib/xpm_ruby/template.rb @@ -0,0 +1,43 @@ +require "ox" + +require_relative "models/template" + +module XpmRuby + module Template + extend self + + class Error < Error; end + + def build(**args) + Models::Template.new(args) + end + + def list(api_key:, account_key:, api_url:) + response = Connection + .new(api_key: api_key, account_key: account_key, api_url: api_url) + .get(endpoint: "template.api/list") + + case response.status + when 401 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + raise Unauthorized.new(hash["html"]["head"]["title"]) + when 200 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + case hash["Response"]["Status"] + when "OK" + hash["Response"]["Templates"]["Template"].map do |template| + Models::Template.new( + uuid: template["UUID"], + name: template["Name"]) + end + when "ERROR" + raise Error.new(response["ErrorDescription"]) + end + else + raise Error.new(response.status) + end + end + end +end diff --git a/spec/vcr_cassettes/xpm_ruby/template/list.yml b/spec/vcr_cassettes/xpm_ruby/template/list.yml new file mode 100644 index 0000000..0973535 --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/template/list.yml @@ -0,0 +1,54 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.workflowmax.com/v3/template.api/list + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic TEST= + User-Agent: + - Faraday v1.0.1 + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Mon, 27 Apr 2020 05:44:32 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '724' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OK + http_version: null + recorded_at: Mon, 27 Apr 2020 05:44:33 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/template_spec.rb b/spec/xpm_ruby/template_spec.rb new file mode 100644 index 0000000..4dfbe28 --- /dev/null +++ b/spec/xpm_ruby/template_spec.rb @@ -0,0 +1,30 @@ +require "spec_helper" + +module XpmRuby + RSpec.describe(Template) do + subject(:service) { described_class } + + describe ".list" do + let(:api_key) { "TEST" } + let(:account_key) { "TEST" } + let(:api_url) { "api.workflowmax.com" } + + around(:each) do |example| + VCR.use_cassette("xpm_ruby/template/list") do + example.run + end + end + + it "lists templates" do + template_list = service.list(api_key: api_key, account_key: account_key, api_url: api_url) + + expect(template_list.length).to eq(11) + + template = template_list.first + + expect(template.name).to eql("Activity Statement") + expect(template.uuid).to eql("d5dd52a0-edc1-4b03-94e7-931aa34ab35c") + end + end + end +end From c687e21fefcb99eabec5c16c25d67d7ec7ad8dde Mon Sep 17 00:00:00 2001 From: abreckner Date: Tue, 28 Apr 2020 10:23:43 +1000 Subject: [PATCH 13/74] Ignt 3563 job current (#11) * Adding job.api/current * don't convert to date (leave as string) * test name update * remove API key --- lib/xpm_ruby.rb | 3 +- lib/xpm_ruby/job.rb | 48 +++++++++++++++++++ lib/xpm_ruby/models/job.rb | 26 +++++++++++ spec/vcr_cassettes/xpm_ruby/job/current.yml | 52 +++++++++++++++++++++ spec/xpm_ruby/job_spec.rb | 35 ++++++++++++++ 5 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 lib/xpm_ruby/job.rb create mode 100644 lib/xpm_ruby/models/job.rb create mode 100644 spec/vcr_cassettes/xpm_ruby/job/current.yml create mode 100644 spec/xpm_ruby/job_spec.rb diff --git a/lib/xpm_ruby.rb b/lib/xpm_ruby.rb index a3f997f..c00a877 100644 --- a/lib/xpm_ruby.rb +++ b/lib/xpm_ruby.rb @@ -3,7 +3,8 @@ class Error < StandardError; end class Unauthorized < Error; end end -require "xpm_ruby/version" require "xpm_ruby/connection" +require "xpm_ruby/job" require "xpm_ruby/staff" require "xpm_ruby/template" +require "xpm_ruby/version" diff --git a/lib/xpm_ruby/job.rb b/lib/xpm_ruby/job.rb new file mode 100644 index 0000000..e2820c2 --- /dev/null +++ b/lib/xpm_ruby/job.rb @@ -0,0 +1,48 @@ +require "ox" + +require_relative "models/job" + +module XpmRuby + module Job + extend self + + class Error < Error; end + + def build(**args) + Models::Job.new(args) + end + + def current(api_key:, account_key:, api_url:) + response = Connection + .new(api_key: api_key, account_key: account_key, api_url: api_url) + .get(endpoint: "job.api/current") + + case response.status + when 401 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + raise Unauthorized.new(hash["html"]["head"]["title"]) + when 200 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + case hash["Response"]["Status"] + when "OK" + hash["Response"]["Jobs"]["Job"].map do |job| + Models::Job.new( + uuid: job["UUID"], + name: job["Name"], + description: job["Description"], + start_date: job["StartDate"], + due_date: job["DueDate"], + completed_date: job["CompletedDate"], + state: job["State"]) + end + when "ERROR" + raise Error.new(response["ErrorDescription"]) + end + else + raise Error.new(response.status) + end + end + end +end diff --git a/lib/xpm_ruby/models/job.rb b/lib/xpm_ruby/models/job.rb new file mode 100644 index 0000000..1bc7b3e --- /dev/null +++ b/lib/xpm_ruby/models/job.rb @@ -0,0 +1,26 @@ +module XpmRuby + module Models + class Job + # job has more fields on it, but these are the only ones we appear to be using + attr_accessor :uuid, :name, :description, :state, :start_date, :due_date, :completed_date + + def initialize(uuid: nil, name: nil, description: nil, state: nil, start_date: nil, due_date: nil, completed_date: nil) + @uuid = uuid + @name = name + @description = description + @state = state + @start_date = start_date + @due_date = due_date + @completed_date = completed_date + end + + def ==(other) + uuid == other.uuid + end + + def eql?(other) + self == other + end + end + end +end diff --git a/spec/vcr_cassettes/xpm_ruby/job/current.yml b/spec/vcr_cassettes/xpm_ruby/job/current.yml new file mode 100644 index 0000000..be25a2c --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/job/current.yml @@ -0,0 +1,52 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.workflowmax.com/v3/job.api/current + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic TEST= + User-Agent: + - Faraday v1.0.1 + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Mon, 27 Apr 2020 06:50:18 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '669' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OKJ000001f6273477-e0d6-4122-b3ff-8373f285aaa7Internal + TimeUse this job to record your internal and non-billable + time for activities such as annual leave, sick leave, professional development, + staff meetings etc55426e7e-426e-4767-a1c6-881598689460Practice + IgnitionPlanned2020-04-20T00:00:002021-04-20T00:00:001cc99c1e-8cf7-4248-ab84-3e11126facbcTony + BrecknerJ000002cf698ae8-e995-4d51-bb36-585634796c9fSetup + and Conversion Steps55426e7e-426e-4767-a1c6-881598689460Practice + IgnitionPlanned2020-04-21T00:00:002020-05-05T00:00:001cc99c1e-8cf7-4248-ab84-3e11126facbcTony + Breckner + http_version: null + recorded_at: Mon, 27 Apr 2020 06:50:19 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/job_spec.rb b/spec/xpm_ruby/job_spec.rb new file mode 100644 index 0000000..f23cbbf --- /dev/null +++ b/spec/xpm_ruby/job_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +module XpmRuby + RSpec.describe(Job) do + subject(:service) { described_class } + + describe ".current" do + let(:api_key) { "TEST" } + let(:account_key) { "TEST" } + let(:api_url) { "api.workflowmax.com" } + + around(:each) do |example| + VCR.use_cassette("xpm_ruby/job/current") do + example.run + end + end + + it "lists current jobs" do + current_jobs = service.current(api_key: api_key, account_key: account_key, api_url: api_url) + + expect(current_jobs.length).to eq(2) + + first_job = current_jobs.first + + expect(first_job.name).to eql("Internal Time") + expect(first_job.uuid).to eql("f6273477-e0d6-4122-b3ff-8373f285aaa7") + expect(first_job.description).to eql("Use this job to record your internal and non-billable time for activities such as annual leave, sick leave, professional development, staff meetings etc") + expect(first_job.state).to eql("Planned") + expect(first_job.start_date).to eql("2020-04-20T00:00:00") + expect(first_job.due_date).to eql("2021-04-20T00:00:00") + expect(first_job.completed_date).to be_nil + end + end + end +end From c06e5061933409723990d4b0534066a60293291f Mon Sep 17 00:00:00 2001 From: abreckner Date: Tue, 28 Apr 2020 11:21:34 +1000 Subject: [PATCH 14/74] Add Faraday post to connection and post test with VCR (#13) * Add Faraday post to connection and post test with VCR * Rubocop fixes --- lib/xpm_ruby/connection.rb | 5 ++ .../xpm_ruby/connection/post.yml | 52 +++++++++++++++++++ spec/xpm_ruby/connection_spec.rb | 25 +++++++++ 3 files changed, 82 insertions(+) create mode 100644 spec/vcr_cassettes/xpm_ruby/connection/post.yml diff --git a/lib/xpm_ruby/connection.rb b/lib/xpm_ruby/connection.rb index 9176617..ce3bbc5 100644 --- a/lib/xpm_ruby/connection.rb +++ b/lib/xpm_ruby/connection.rb @@ -16,6 +16,11 @@ def get(endpoint:) Faraday.new(url(endpoint: endpoint), headers: headers).get end + def post(endpoint:, data:) + faraday_connection = Faraday.new("https://#{@api_url}/v3/") + faraday_connection.post(endpoint, data, headers) + end + private def headers diff --git a/spec/vcr_cassettes/xpm_ruby/connection/post.yml b/spec/vcr_cassettes/xpm_ruby/connection/post.yml new file mode 100644 index 0000000..2d566fa --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/connection/post.yml @@ -0,0 +1,52 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.workflowmax.com/v3/job.api/add + body: + encoding: UTF-8 + string: "\n \n Brochure Design\n Detailed + description of the job\n e349fc1b-d92d-4ba2-b9fc-69fdd516e2a2\n + \ 20291023\n 20291028\n + \ \n " + headers: + User-Agent: + - Faraday v1.0.1 + Authorization: + - Basic TEST= + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Tue, 28 Apr 2020 01:01:38 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '432' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OKJ00002709d0978b-23c2-4356-b180-a230e9cf95a7Brochure + DesignDetailed description of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a2ABC + CoPlanned2029-10-23T00:00:002029-10-28T00:00:00 + http_version: null + recorded_at: Tue, 28 Apr 2020 01:01:38 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/connection_spec.rb b/spec/xpm_ruby/connection_spec.rb index 6fc1707..2c506f8 100644 --- a/spec/xpm_ruby/connection_spec.rb +++ b/spec/xpm_ruby/connection_spec.rb @@ -26,5 +26,30 @@ module XpmRuby connection.get(endpoint: "staff.api/list") end end + + describe "#post" do + let(:api_key) { "TEST" } + let(:account_key) { "TEST" } + let(:api_url) { "api.workflowmax.com" } + + let(:xml_string) do + "Brochure DesignDetailed description of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a22029102320291028" + end + + around(:each) do |example| + VCR.use_cassette("xpm_ruby/connection/post") do + example.run + end + end + + it "should post to Faraday with the right endpoint, data and headers" do + connection = service.new(api_key: api_key, api_url: api_url, account_key: account_key) + response = connection.post(endpoint: "job.api/add", data: xml_string) + + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + expect(hash["Response"]["Status"]).to eq("OK") + end + end end end From a4bbf662907a03c7abbf833d0e8687c352a4b1b8 Mon Sep 17 00:00:00 2001 From: abreckner Date: Wed, 29 Apr 2020 09:01:24 +1000 Subject: [PATCH 15/74] Refactor connection (#16) * Switch `get` tests from mocks to VCR * Remove encoded auth * refactor get and post to be more similar and add content type to post * rubocop fix --- lib/xpm_ruby/connection.rb | 14 ++--- .../vcr_cassettes/xpm_ruby/connection/get.yml | 52 +++++++++++++++++++ .../xpm_ruby/connection/post.yml | 16 +++--- spec/xpm_ruby/connection_spec.rb | 15 +++--- 4 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 spec/vcr_cassettes/xpm_ruby/connection/get.yml diff --git a/lib/xpm_ruby/connection.rb b/lib/xpm_ruby/connection.rb index ce3bbc5..4c00d3a 100644 --- a/lib/xpm_ruby/connection.rb +++ b/lib/xpm_ruby/connection.rb @@ -12,13 +12,15 @@ def initialize(account_key:, api_key:, api_url:) @basic_auth = "Basic " + Base64.strict_encode64("#{api_key}:#{account_key}") end - def get(endpoint:) - Faraday.new(url(endpoint: endpoint), headers: headers).get + def get(endpoint:, params: nil) + faraday_connection = Faraday.new(url) + faraday_connection.get(endpoint, params, headers) end def post(endpoint:, data:) - faraday_connection = Faraday.new("https://#{@api_url}/v3/") - faraday_connection.post(endpoint, data, headers) + faraday_connection = Faraday.new(url) + puts(headers.merge(content_type: "application/xml")) + faraday_connection.post(endpoint, data, headers.merge(content_type: "application/xml")) end private @@ -27,8 +29,8 @@ def headers { "Authorization" => @basic_auth } end - def url(endpoint:) - "https://#{@api_url}/v3/#{endpoint}" + def url + "https://#{@api_url}/v3/" end end end diff --git a/spec/vcr_cassettes/xpm_ruby/connection/get.yml b/spec/vcr_cassettes/xpm_ruby/connection/get.yml new file mode 100644 index 0000000..659add4 --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/connection/get.yml @@ -0,0 +1,52 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.workflowmax.com/v3/staff.api/list + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - Basic TEST= + User-Agent: + - Faraday v1.0.1 + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Tue, 28 Apr 2020 01:27:12 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '801' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OK8c79202e-caf8-4a12-a3d7-ac338e50741fDev + Testingdev@practiceignition.com
2fd3a292-eeeb-4dea-9deb-0b0d3e2a8e4eEd + Minnluis+edminn@practiceignition.com
54b0dace-1e82-4403-8b87-2d5874db28e6Jana + Paulechjana@practiceignition.com
3be259b2-68f8-4bce-8dc5-4d7004d41f66Nick + Daintynick@practiceignition.com
79ec70c2-4956-4239-8448-8484ddd03f25Nick + Daintynick+xpmtest2@practiceignition.com
e71b8196-9033-40f0-ba5e-f689ecf881cfPatrick + Frigopatrick.frigo@xero.com
1f0585b0-1b53-4fd0-b97d-3e7e8c20b5bcPatty + Igneousluis@practiceignition.com
6bbd3326-1a23-4bb2-bcbe-ffa51bd76625Some + Usersome_user@pattyrocks.com
7d33e725-02f5-4676-976e-ea63f7bed6c3Testchris@practiceignition.com
6e73ba03-d7f3-49ec-b5be-39843aa7fc46testadammikulas@gmail.com
+ http_version: null + recorded_at: Tue, 28 Apr 2020 01:27:13 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/connection/post.yml b/spec/vcr_cassettes/xpm_ruby/connection/post.yml index 2d566fa..af78f53 100644 --- a/spec/vcr_cassettes/xpm_ruby/connection/post.yml +++ b/spec/vcr_cassettes/xpm_ruby/connection/post.yml @@ -5,17 +5,15 @@ http_interactions: uri: https://api.workflowmax.com/v3/job.api/add body: encoding: UTF-8 - string: "\n \n Brochure Design\n Detailed - description of the job\n e349fc1b-d92d-4ba2-b9fc-69fdd516e2a2\n - \ 20291023\n 20291028\n - \ \n " + string: "Brochure DesignDetailed description + of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a22029102320291028" headers: User-Agent: - Faraday v1.0.1 Authorization: - Basic TEST= Content-Type: - - application/x-www-form-urlencoded + - application/xml response: status: code: 200 @@ -28,7 +26,7 @@ http_interactions: content-type: - text/xml; charset=utf-8 date: - - Tue, 28 Apr 2020 01:01:38 GMT + - Tue, 28 Apr 2020 02:16:27 GMT server: - Microsoft-IIS/10.0 vary: @@ -38,15 +36,15 @@ http_interactions: x-aspnetmvc-version: - '4.0' content-length: - - '432' + - '434' connection: - keep-alive body: encoding: ASCII-8BIT - string: OKJ00002709d0978b-23c2-4356-b180-a230e9cf95a7Brochure + string: OKJ000028a979d2ef-0085-4f2b-b0dc-274847e1044cBrochure DesignDetailed description of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a2ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:00 http_version: null - recorded_at: Tue, 28 Apr 2020 01:01:38 GMT + recorded_at: Tue, 28 Apr 2020 02:16:29 GMT recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/connection_spec.rb b/spec/xpm_ruby/connection_spec.rb index 2c506f8..7c51426 100644 --- a/spec/xpm_ruby/connection_spec.rb +++ b/spec/xpm_ruby/connection_spec.rb @@ -16,22 +16,23 @@ module XpmRuby end describe "#get" do - let(:faraday_connection) { instance_double("Faraday::Connection", get: nil) } + around(:each) do |example| + VCR.use_cassette("xpm_ruby/connection/get") do + example.run + end + end it "should do a get via Faraday" do connection = service.new(api_key: api_key, api_url: api_url, account_key: account_key) + response = connection.get(endpoint: "staff.api/list") - expect(Faraday).to receive(:new).with("https://api.workflowmax.com/v3/staff.api/list", headers: { "Authorization" => "Basic dGVzdDp0ZXN0" }).and_return(faraday_connection) + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) - connection.get(endpoint: "staff.api/list") + expect(hash["Response"]["Status"]).to eq("OK") end end describe "#post" do - let(:api_key) { "TEST" } - let(:account_key) { "TEST" } - let(:api_url) { "api.workflowmax.com" } - let(:xml_string) do "Brochure DesignDetailed description of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a22029102320291028" end From 95e2c46674e72723748ebe8e460478376ed7525e Mon Sep 17 00:00:00 2001 From: Adam Mikulasev Date: Wed, 29 Apr 2020 09:28:38 +1000 Subject: [PATCH 16/74] Client.add (#14) * add Staff.list * fix model namespace * remove extra line * drop sax parser * remove parser spec * optimise * fix payroll_code * commit unfinished changes * add incomplete spec * initial commit * update spec * commit changes * Add module * add Nokogiri::Xml::Builder * fix require * pass spec * fix cops * update based on Tony's feedback * fix spacing * fix ordering * fix ordering --- .rubocop.yml | 3 + Gemfile.lock | 4 + lib/xpm_ruby.rb | 3 + lib/xpm_ruby/client.rb | 88 +++++++++++++ lib/xpm_ruby/models/client.rb | 140 +++++++++++++++++++++ spec/vcr_cassettes/xpm_ruby/client/add.yml | 51 ++++++++ spec/xpm_ruby/client_spec.rb | 83 ++++++++++++ xpm_ruby.gemspec | 1 + 8 files changed, 373 insertions(+) create mode 100644 lib/xpm_ruby/client.rb create mode 100644 lib/xpm_ruby/models/client.rb create mode 100644 spec/vcr_cassettes/xpm_ruby/client/add.yml create mode 100644 spec/xpm_ruby/client_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index adfe750..9059597 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -452,3 +452,6 @@ Style/SymbolProc: Style/ZeroLengthPredicate: Enabled: false + +Style/MutableConstant: + Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index 1e675d5..6c6f6af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,7 @@ PATH specs: xpm_ruby (0.1.0) faraday (~> 1) + nokogiri ox (~> 2.13) GEM @@ -16,7 +17,10 @@ GEM multipart-post (>= 1.2, < 3) jaro_winkler (1.5.4) method_source (1.0.0) + mini_portile2 (2.4.0) multipart-post (2.1.1) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) ox (2.13.2) parallel (1.19.1) parser (2.7.1.1) diff --git a/lib/xpm_ruby.rb b/lib/xpm_ruby.rb index c00a877..e3a433c 100644 --- a/lib/xpm_ruby.rb +++ b/lib/xpm_ruby.rb @@ -3,6 +3,9 @@ class Error < StandardError; end class Unauthorized < Error; end end +require "nokogiri" + +require "xpm_ruby/client" require "xpm_ruby/connection" require "xpm_ruby/job" require "xpm_ruby/staff" diff --git a/lib/xpm_ruby/client.rb b/lib/xpm_ruby/client.rb new file mode 100644 index 0000000..0712a25 --- /dev/null +++ b/lib/xpm_ruby/client.rb @@ -0,0 +1,88 @@ +require_relative "models/client" + +module XpmRuby + module Client + extend self + + module GstPeriod + ONE = "1" + TWO = "2" + SIX = "6" + end + + module GstBasis + INVOICE = "Invoice" + PAYMENT = "Payment" + HYBRID = "Hybrid" + end + + module ProvisionalTaxBasis + STANDARD_OPTION = "Standard Option" + ESTIMATE_OPTION = "Estimate Option" + RATIO_OPTION = "Ratio Option" + end + + module AgencyStatus + WITH_EOT = "With EOT" + WITHOUT_EOT = "Without EOT" + UNLINKED = "Unlinked" + end + + module ReturnType + IR3 = "IR3" + IR3NR = "IR3NR" + IR4 = "IR4" + IR6 = "IR6" + IR7 = "IR7" + IR9 = "IR9" + PTS = "PTS" + end + + module Contact + extend self + + def build(**args) + Models::Client::Contact.new(args) + end + end + + def build(**args) + Models::Client.new(args) + end + + def add(api_key:, account_key:, api_url:, client:) + builder = ::Nokogiri::XML::Builder.new do |xml| + xml.Client do + xml.Name do + xml.text(client.name) + end + end + end + + response = Connection + .new(api_key: api_key, account_key: account_key, api_url: api_url) + .post(endpoint: "client.api/add", data: builder.doc.root.to_xml) + + case response.status + when 401 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + raise Unauthorized.new(hash["html"]["head"]["title"]) + when 200 + hash = Ox.load(response.body, mode: :hash_no_attrs, symbolize_keys: false) + + case hash["Response"]["Status"] + when "OK" + Client.build( + uuid: hash["Response"]["Client"]["UUID"], + name: hash["Response"]["Client"]["Name"], + email: hash["Response"]["Client"]["Email"]) + when "ERROR" + raise Error.new(response["ErrorDescription"]) + end + else + raise Error.new(response.status) + end + end + end +end diff --git a/lib/xpm_ruby/models/client.rb b/lib/xpm_ruby/models/client.rb new file mode 100644 index 0000000..32b00db --- /dev/null +++ b/lib/xpm_ruby/models/client.rb @@ -0,0 +1,140 @@ +module XpmRuby + module Models + class Client + attr_accessor :uuid, :name, :email, :address, :city, :region, :post_code, :country, + :postal_address, :postal_city, :postal_region, :postal_post_code, :postal_country, + :phone, :fax, :web_site, :referral_source, :export_code, :is_prospect, + :account_manager_uuid, :contacts, :billing_client_uuid, + :first_name, :last_name, :other_name, :date_of_birth, :job_manager_uuid, + :tax_number, :company_number, :business_number, :business_structure, :balance_month, + :prepare_gst, :gst_registered, :gst_period, :gst_basis, + :provisional_tax_basis, :provisional_tax_ratio, + :signed_tax_authority, :tax_agent, :agency_status, :return_type, + :prepare_activity_statement, :prepare_tax_return + + # rubocop:disable Metrics/AbcSize + def initialize(uuid: nil, name:, email: nil, + address: nil, city: nil, region: nil, post_code: nil, country: nil, + postal_address: nil, postal_city: nil, postal_region: nil, + postal_post_code: nil, postal_country: nil, + phone: nil, fax: nil, web_site: nil, + referral_source: nil, export_code: nil, is_prospect: nil, + account_manager_uuid: nil, contacts: nil, billing_client_uuid: nil, + first_name: nil, last_name: nil, other_name: nil, date_of_birth: nil, + job_manager_uuid: nil, tax_number: nil, company_number: nil, + business_number: nil, business_structure: nil, balance_month: nil, + prepare_gst: nil, gst_registered: nil, gst_period: nil, gst_basis: nil, + provisional_tax_basis: nil, provisional_tax_ratio: nil, + signed_tax_authority: nil, tax_agent: nil, agency_status: nil, + return_type: nil, prepare_activity_statement: nil, prepare_tax_return: nil) + @uuid = uuid + @name = name + @email = email + @address = address + @city = city + @region = region + @post_code = post_code + @country = country + @postal_address = postal_address + @postal_city = postal_city + @postal_region = postal_region + @postal_post_code = postal_post_code + @postal_country = postal_country + @phone = phone + @fax = fax + @web_site = web_site + @referral_source = referral_source + @export_code = export_code + @is_prospect = is_prospect + @account_manager_uuid = account_manager_uuid + @contacts = contacts + @billing_client_uuid = billing_client_uuid + @first_name = first_name + @last_name = last_name + @other_name = other_name + @date_of_birth = date_of_birth + @job_manager_uuid = job_manager_uuid + @tax_number = tax_number + @company_number = company_number + @business_number = business_number + @business_structure = business_structure + @balance_month = balance_month + @prepare_gst = prepare_gst + @gst_registered = gst_registered + @gst_period = gst_period + @gst_basis = gst_basis + @provisional_tax_basis = provisional_tax_basis + @provisional_tax_rate = provisional_tax_ratio + @signed_tax_authority = signed_tax_authority + @tax_agent = tax_agent + @agency_status = agency_status + @return_type = return_type + @prepare_activity_statement = prepare_activity_statement + @prepare_tax_return = prepare_tax_return + end + # rubocop:enable Metrics/AbcSize + + class AccountManager + attr_reader :uuid, :name + + def initialize(uuid: nil, name: nil) + @uuid = uuid + @name = name + end + + def ==(other) + uuid == other.uuid + end + + def eql?(other) + self == other + end + end + + class Type + attr_reader :name, :cost_markup, :payment_term, :payment_day + + def initialize(name: nil, cost_markup: nil, payment_term: nil, payment_day: nil) + @name = name + @cost_markup = cost_markup + @payment_term = payment_term + @payment_day = payment_day + end + + def ==(other) + name == other.name && + cost_markup == other.cost_markup && + payment_term == other.payment_term && + payment_day == other.payment_day + end + + def eql?(other) + self == other + end + end + + class Contact + def initialize(uuid: nil, is_primary: nil, name: nil, salutation: nil, + addressee: nil, mobile: nil, email: nil, phone: nil, position: nil) + @uuid = uuid + @is_primary = is_primary + @name = name + @salutation = salutation + @addressee = addressee + @mobile = mobile + @email = email + @phone = phone + @position = position + end + + def ==(other) + uuid == other.uuid + end + + def eql?(other) + self == other + end + end + end + end +end diff --git a/spec/vcr_cassettes/xpm_ruby/client/add.yml b/spec/vcr_cassettes/xpm_ruby/client/add.yml new file mode 100644 index 0000000..94cbdbe --- /dev/null +++ b/spec/vcr_cassettes/xpm_ruby/client/add.yml @@ -0,0 +1,51 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.workflowmax.com/v3/client.api/add + body: + encoding: UTF-8 + string: |- + + Acmer Pty Ltd + + headers: + User-Agent: + - Faraday v1.0.1 + Authorization: + - Basic + Content-Type: + - application/x-www-form-urlencoded + response: + status: + code: 200 + message: OK + headers: + access-control-allow-origin: + - "*" + cache-control: + - private + content-type: + - text/xml; charset=utf-8 + date: + - Tue, 28 Apr 2020 01:52:47 GMT + server: + - Microsoft-IIS/10.0 + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-aspnetmvc-version: + - '4.0' + content-length: + - '449' + connection: + - keep-alive + body: + encoding: ASCII-8BIT + string: OK9f868ba7-437c-4574-9a17-8c6f4890545bAcmer + Pty Ltd
NoNoNo
+ http_version: null + recorded_at: Tue, 28 Apr 2020 01:52:48 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/xpm_ruby/client_spec.rb b/spec/xpm_ruby/client_spec.rb new file mode 100644 index 0000000..260941f --- /dev/null +++ b/spec/xpm_ruby/client_spec.rb @@ -0,0 +1,83 @@ +require "spec_helper" + +module XpmRuby + RSpec.describe(Client) do + around(:each) do |example| + VCR.use_cassette("xpm_ruby/client/add") do + example.run + end + end + + describe ".add" do + let(:api_key) { "" } + let(:account_key) { "" } + let(:api_url) { "api.workflowmax.com" } + + let(:client) do + Client.build( + name: "Acmer Pty Ltd", + email: "someone@example.com", + address: "1 Address Place", + city: "Sydney", + region: "NSW", + post_code: "2000", + country: "Australia", + postal_address: "Level 32, PWC Building\n188 Quay Street\nAuckland Central", + postal_city: "Auckland", + postal_region: "North Island", + postal_post_code: "1001", + postal_country: "New Zealand", + phone: "00 0000 0000", + fax: "00 1000 0000", + web_site: "http://example.com", + referral_source: "referrer", + export_code: "EXPORT_CODE", + is_prospect: false, + account_manager_uuid: nil, + contacts: [ + Client::Contact.build( + name: "Someone else", + is_primary: true, + salutation: "MR", + addressee: "Addressee", + phone: "02 0000 0000", + mobile: "0411 0000 0000", + email: "someone.else@example.com", + position: "Manager")], + billing_client_uuid: nil, + first_name: "Someone", + last_name: "Person", + date_of_birth: Date.parse("1987/05/11"), + job_manager_uuid: nil, + tax_number: "11 1111 1111", + company_number: "02 1000 1000", + business_number: "02 1000 2000", + business_structure: "Corporate", + balance_month: "Jan", + prepare_gst: false, + gst_registered: true, + gst_period: Client::GstPeriod::ONE, + gst_basis: Client::GstBasis::INVOICE, + provisional_tax_basis: Client::ProvisionalTaxBasis::STANDARD_OPTION, + provisional_tax_ratio: "1", + signed_tax_authority: true, + tax_agent: "Mr Tax Agent", + agency_status: Client::AgencyStatus::WITH_EOT, + return_type: Client::ReturnType::IR3, + prepare_activity_statement: true, + prepare_tax_return: true) + end + + it "adds client" do + created_client = Client.add( + api_key: api_key, + account_key: account_key, + api_url: api_url, + client: client) + + expect(created_client.uuid).not_to be_nil + expect(created_client.name).to eql(client.name) + end + end + end +end diff --git a/xpm_ruby.gemspec b/xpm_ruby.gemspec index a8ea1c9..5c3cbc3 100644 --- a/xpm_ruby.gemspec +++ b/xpm_ruby.gemspec @@ -36,6 +36,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency("pry-byebug", "~> 3") spec.add_runtime_dependency("faraday", "~> 1") + spec.add_runtime_dependency("nokogiri") spec.add_runtime_dependency("ox", "~> 2.13") spec.add_development_dependency("vcr") From 40cab17e440d40288b0b7b2d616d9d22ef79bc6c Mon Sep 17 00:00:00 2001 From: abreckner Date: Wed, 29 Apr 2020 11:37:03 +1000 Subject: [PATCH 17/74] Use Oauth2 access_token and xero tenant id to instantiate connection (#17) * Refactor connection to use access token and xero_tenant_id * Fix job spec * use access_token for staff * template fix * rubocop fixes * Use new connection settings for client * Rubocop fix --- lib/xpm_ruby/client.rb | 4 +- lib/xpm_ruby/connection.rb | 17 ++- lib/xpm_ruby/job.rb | 4 +- lib/xpm_ruby/staff.rb | 4 +- lib/xpm_ruby/template.rb | 4 +- spec/vcr_cassettes/xpm_ruby/client/add.yml | 48 ++++---- .../vcr_cassettes/xpm_ruby/connection/get.yml | 64 ++++++----- .../xpm_ruby/connection/post.yml | 54 +++++---- spec/vcr_cassettes/xpm_ruby/job/current.yml | 107 +++++++++++++----- spec/vcr_cassettes/xpm_ruby/staff/list.yml | 56 +++++---- spec/vcr_cassettes/xpm_ruby/template/list.yml | 65 ++++++----- spec/xpm_ruby/client_spec.rb | 12 +- spec/xpm_ruby/connection_spec.rb | 18 +-- spec/xpm_ruby/job_spec.rb | 21 ++-- spec/xpm_ruby/staff_spec.rb | 13 +-- spec/xpm_ruby/template_spec.rb | 9 +- 16 files changed, 292 insertions(+), 208 deletions(-) diff --git a/lib/xpm_ruby/client.rb b/lib/xpm_ruby/client.rb index 0712a25..95a10c0 100644 --- a/lib/xpm_ruby/client.rb +++ b/lib/xpm_ruby/client.rb @@ -50,7 +50,7 @@ def build(**args) Models::Client.new(args) end - def add(api_key:, account_key:, api_url:, client:) + def add(access_token:, xero_tenant_id:, client:) builder = ::Nokogiri::XML::Builder.new do |xml| xml.Client do xml.Name do @@ -60,7 +60,7 @@ def add(api_key:, account_key:, api_url:, client:) end response = Connection - .new(api_key: api_key, account_key: account_key, api_url: api_url) + .new(access_token: access_token, xero_tenant_id: xero_tenant_id) .post(endpoint: "client.api/add", data: builder.doc.root.to_xml) case response.status diff --git a/lib/xpm_ruby/connection.rb b/lib/xpm_ruby/connection.rb index 4c00d3a..6db9808 100644 --- a/lib/xpm_ruby/connection.rb +++ b/lib/xpm_ruby/connection.rb @@ -3,13 +3,11 @@ module XpmRuby class Connection - attr_accessor :api_url, :account_key, :api_key, :basic_auth + attr_accessor :xero_tenant_id, :authorization - def initialize(account_key:, api_key:, api_url:) - @api_url = api_url - @account_key = account_key - @api_key = api_key - @basic_auth = "Basic " + Base64.strict_encode64("#{api_key}:#{account_key}") + def initialize(access_token:, xero_tenant_id:) + @xero_tenant_id = xero_tenant_id + @authorization = "Bearer " + access_token end def get(endpoint:, params: nil) @@ -19,18 +17,17 @@ def get(endpoint:, params: nil) def post(endpoint:, data:) faraday_connection = Faraday.new(url) - puts(headers.merge(content_type: "application/xml")) - faraday_connection.post(endpoint, data, headers.merge(content_type: "application/xml")) + faraday_connection.post(endpoint, data, headers) end private def headers - { "Authorization" => @basic_auth } + { "Authorization" => @authorization, "xero-tenant-id" => @xero_tenant_id, "content_type" => "application/xml" } end def url - "https://#{@api_url}/v3/" + "https://api.xero.com/practicemanager/3.0/" end end end diff --git a/lib/xpm_ruby/job.rb b/lib/xpm_ruby/job.rb index e2820c2..75669de 100644 --- a/lib/xpm_ruby/job.rb +++ b/lib/xpm_ruby/job.rb @@ -12,9 +12,9 @@ def build(**args) Models::Job.new(args) end - def current(api_key:, account_key:, api_url:) + def current(access_token:, xero_tenant_id:) response = Connection - .new(api_key: api_key, account_key: account_key, api_url: api_url) + .new(access_token: access_token, xero_tenant_id: xero_tenant_id) .get(endpoint: "job.api/current") case response.status diff --git a/lib/xpm_ruby/staff.rb b/lib/xpm_ruby/staff.rb index 0084f6f..c1b1654 100644 --- a/lib/xpm_ruby/staff.rb +++ b/lib/xpm_ruby/staff.rb @@ -12,9 +12,9 @@ def build(**args) Models::Staff.new(args) end - def list(api_key:, account_key:, api_url:) + def list(access_token:, xero_tenant_id:) response = Connection - .new(api_key: api_key, account_key: account_key, api_url: api_url) + .new(access_token: access_token, xero_tenant_id: xero_tenant_id) .get(endpoint: "staff.api/list") case response.status diff --git a/lib/xpm_ruby/template.rb b/lib/xpm_ruby/template.rb index 4500146..59f6dfb 100644 --- a/lib/xpm_ruby/template.rb +++ b/lib/xpm_ruby/template.rb @@ -12,9 +12,9 @@ def build(**args) Models::Template.new(args) end - def list(api_key:, account_key:, api_url:) + def list(access_token:, xero_tenant_id:) response = Connection - .new(api_key: api_key, account_key: account_key, api_url: api_url) + .new(access_token: access_token, xero_tenant_id: xero_tenant_id) .get(endpoint: "template.api/list") case response.status diff --git a/spec/vcr_cassettes/xpm_ruby/client/add.yml b/spec/vcr_cassettes/xpm_ruby/client/add.yml index 94cbdbe..8bba206 100644 --- a/spec/vcr_cassettes/xpm_ruby/client/add.yml +++ b/spec/vcr_cassettes/xpm_ruby/client/add.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://api.workflowmax.com/v3/client.api/add + uri: https://api.xero.com/practicemanager/3.0/client.api/add body: encoding: UTF-8 string: |- @@ -13,7 +13,11 @@ http_interactions: User-Agent: - Faraday v1.0.1 Authorization: - - Basic + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMjI5NjIsImV4cCI6MTU4ODEyNDc2MiwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODEyMjk1NCwieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6ImMyMGI5NTg2NzA2MzQ0MTZiZmFmYjQ3YWY3NzY2NmE3IiwianRpIjoiMGM3OWM5ZGYwZjY0YmFiMzkyNmM0MzdkOWVhZDI2ZWIiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.LRa5A9ZgTx8wdYSkD79KVkXmPG_hSclxQZ6PJJtRHHsEf8bnuL0awxzeTLjVCWh-tfYsA7nJv0fWDJwtqbZOeRA6qVR6QxLGE8-LYBnPDi2BcOcvUfSlBcQtpJP8Imf0hBl_luvkPVazi8ZYcEX4dgdLFBYdaXDijF-2kQEoJAXkWaLK0TWQbT9sWpfRzK0sPUU2Y9bws3A3GqGmjmP5s6B92wM06JBHfbjL2O3yIKK_2f47jag6wS-gmboBy0Zhv8wiN_nLSum7R26U6EmESLza4o-LzG8WQYSoUVet5mR0PxkGtSG5mOT3IYd9xKfmipTpdoKQAaKfqFC_dyexiA + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: + - application/xml Content-Type: - application/x-www-form-urlencoded response: @@ -21,31 +25,35 @@ http_interactions: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Tue, 28 Apr 2020 01:52:47 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4990' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - 8e10db09-d267-43d7-910c-4098fa490a69 content-length: - - '449' + - '634' + expires: + - Wed, 29 Apr 2020 01:18:05 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Wed, 29 Apr 2020 01:18:05 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OK9f868ba7-437c-4574-9a17-8c6f4890545bAcmer + encoding: UTF-8 + string: OK25697701Acmer Pty Ltd
NoNoNo
+ />fca33011-9be0-474c-bd3e-91ca18f74d81
http_version: null - recorded_at: Tue, 28 Apr 2020 01:52:48 GMT + recorded_at: Wed, 29 Apr 2020 01:18:05 GMT recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/connection/get.yml b/spec/vcr_cassettes/xpm_ruby/connection/get.yml index 659add4..7b09d4d 100644 --- a/spec/vcr_cassettes/xpm_ruby/connection/get.yml +++ b/spec/vcr_cassettes/xpm_ruby/connection/get.yml @@ -2,51 +2,59 @@ http_interactions: - request: method: get - uri: https://api.workflowmax.com/v3/staff.api/list + uri: https://api.xero.com/practicemanager/3.0/staff.api/list body: encoding: US-ASCII string: '' headers: - Authorization: - - Basic TEST= User-Agent: - Faraday v1.0.1 + Authorization: + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMTUyMTQsImV4cCI6MTU4ODExNzAxNCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODA1MTE0MywieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6IjQzMGI0ZmVmMWI0NjQ2MGZiMTgwOWNmNmQ5OWJhODIxIiwianRpIjoiMmI3NGQxZDZhMzcxNDlhN2VjNjkwNmM2NGM0MDFlMjEiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.EJ5_dU4efS9e2w68A63GQaVWghmcIONEOfkB4Wp0IGNwTbNU441x3vSAMdRY5MShT1jk9cTR-207OKClFJAuwWZbODQcs2bV9YDj5PH9cCtNCULFOClQCn7zfUonkMdZ9FiL4RjJ6xXbWOmfD-vYhQRLbAkKDcZad8HcPIzPyKvyHFuxTDk7FKs-OI3sUPQUqQrBKAcmD2C8PR8al7PNn0kwrug1a2_R0z74Sygg1iKJlShMLMBbaDfq_7zxbMvGrLvW1vLMlJDhxD-sR4_T-B3n6_VDFybFfShQqtkoJwk4-fAqc0S8N0Vmx_kRLqzVEIE8NiouqnTvt6i8Bvc5PQ + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: + - application/xml response: status: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Tue, 28 Apr 2020 01:27:12 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4999' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - f2154beb-32f3-47aa-8a0a-e327cf7ebb9f content-length: - - '801' + - '1794' + expires: + - Tue, 28 Apr 2020 23:17:54 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Tue, 28 Apr 2020 23:17:54 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OK8c79202e-caf8-4a12-a3d7-ac338e50741fDev - Testingdev@practiceignition.com
2fd3a292-eeeb-4dea-9deb-0b0d3e2a8e4eEd - Minnluis+edminn@practiceignition.com
54b0dace-1e82-4403-8b87-2d5874db28e6Jana - Paulechjana@practiceignition.com
3be259b2-68f8-4bce-8dc5-4d7004d41f66Nick - Daintynick@practiceignition.com
79ec70c2-4956-4239-8448-8484ddd03f25Nick - Daintynick+xpmtest2@practiceignition.com
e71b8196-9033-40f0-ba5e-f689ecf881cfPatrick - Frigopatrick.frigo@xero.com
1f0585b0-1b53-4fd0-b97d-3e7e8c20b5bcPatty - Igneousluis@practiceignition.com
6bbd3326-1a23-4bb2-bcbe-ffa51bd76625Some - Usersome_user@pattyrocks.com
7d33e725-02f5-4676-976e-ea63f7bed6c3Testchris@practiceignition.com
6e73ba03-d7f3-49ec-b5be-39843aa7fc46testadammikulas@gmail.com
+ encoding: UTF-8 + string: OK859230Dev + Testingdev@practiceignition.com
859317Ed + Minnluis+edminn@practiceignition.com
858949Jana + Paulechjana@practiceignition.com
859231Nick + Daintynick@practiceignition.com
863967Nick + Daintynick+xpmtest2@practiceignition.com
858948Patrick + Frigopatrick.frigo@xero.com
859319Patty + Igneousluis@practiceignition.com
859318Some + Usersome_user@pattyrocks.com
863927Testchris@practiceignition.com
866437testadammikulas@gmail.com
http_version: null - recorded_at: Tue, 28 Apr 2020 01:27:13 GMT + recorded_at: Tue, 28 Apr 2020 23:17:54 GMT recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/connection/post.yml b/spec/vcr_cassettes/xpm_ruby/connection/post.yml index af78f53..97b8fbd 100644 --- a/spec/vcr_cassettes/xpm_ruby/connection/post.yml +++ b/spec/vcr_cassettes/xpm_ruby/connection/post.yml @@ -2,49 +2,57 @@ http_interactions: - request: method: post - uri: https://api.workflowmax.com/v3/job.api/add + uri: https://api.xero.com/practicemanager/3.0/job.api/add body: encoding: UTF-8 string: "Brochure DesignDetailed description - of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a22029102320291028" + of the job240976422029102320291028
" headers: User-Agent: - Faraday v1.0.1 Authorization: - - Basic TEST= - Content-Type: + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMTUyMTQsImV4cCI6MTU4ODExNzAxNCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODA1MTE0MywieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6IjQzMGI0ZmVmMWI0NjQ2MGZiMTgwOWNmNmQ5OWJhODIxIiwianRpIjoiMmI3NGQxZDZhMzcxNDlhN2VjNjkwNmM2NGM0MDFlMjEiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.EJ5_dU4efS9e2w68A63GQaVWghmcIONEOfkB4Wp0IGNwTbNU441x3vSAMdRY5MShT1jk9cTR-207OKClFJAuwWZbODQcs2bV9YDj5PH9cCtNCULFOClQCn7zfUonkMdZ9FiL4RjJ6xXbWOmfD-vYhQRLbAkKDcZad8HcPIzPyKvyHFuxTDk7FKs-OI3sUPQUqQrBKAcmD2C8PR8al7PNn0kwrug1a2_R0z74Sygg1iKJlShMLMBbaDfq_7zxbMvGrLvW1vLMlJDhxD-sR4_T-B3n6_VDFybFfShQqtkoJwk4-fAqc0S8N0Vmx_kRLqzVEIE8NiouqnTvt6i8Bvc5PQ + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: - application/xml + Content-Type: + - application/x-www-form-urlencoded response: status: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Tue, 28 Apr 2020 02:16:27 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4996' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - e81ba109-9c33-4457-853b-6d1a17406718 content-length: - - '434' + - '441' + expires: + - Tue, 28 Apr 2020 23:28:07 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Tue, 28 Apr 2020 23:28:07 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OKJ000028a979d2ef-0085-4f2b-b0dc-274847e1044cBrochure - DesignDetailed description of the jobe349fc1b-d92d-4ba2-b9fc-69fdd516e2a2ABC - CoPlanned2029-10-23T00:00:002029-10-28T00:00:00OKJ000029Brochure + DesignDetailed description of the job24097642ABC + CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044346180 http_version: null - recorded_at: Tue, 28 Apr 2020 02:16:29 GMT + recorded_at: Tue, 28 Apr 2020 23:28:07 GMT recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/job/current.yml b/spec/vcr_cassettes/xpm_ruby/job/current.yml index be25a2c..fcfed12 100644 --- a/spec/vcr_cassettes/xpm_ruby/job/current.yml +++ b/spec/vcr_cassettes/xpm_ruby/job/current.yml @@ -2,51 +2,102 @@ http_interactions: - request: method: get - uri: https://api.workflowmax.com/v3/job.api/current + uri: https://api.xero.com/practicemanager/3.0/job.api/current body: encoding: US-ASCII string: '' headers: - Authorization: - - Basic TEST= User-Agent: - Faraday v1.0.1 + Authorization: + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMTUyMTQsImV4cCI6MTU4ODExNzAxNCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODA1MTE0MywieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6IjQzMGI0ZmVmMWI0NjQ2MGZiMTgwOWNmNmQ5OWJhODIxIiwianRpIjoiMmI3NGQxZDZhMzcxNDlhN2VjNjkwNmM2NGM0MDFlMjEiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.EJ5_dU4efS9e2w68A63GQaVWghmcIONEOfkB4Wp0IGNwTbNU441x3vSAMdRY5MShT1jk9cTR-207OKClFJAuwWZbODQcs2bV9YDj5PH9cCtNCULFOClQCn7zfUonkMdZ9FiL4RjJ6xXbWOmfD-vYhQRLbAkKDcZad8HcPIzPyKvyHFuxTDk7FKs-OI3sUPQUqQrBKAcmD2C8PR8al7PNn0kwrug1a2_R0z74Sygg1iKJlShMLMBbaDfq_7zxbMvGrLvW1vLMlJDhxD-sR4_T-B3n6_VDFybFfShQqtkoJwk4-fAqc0S8N0Vmx_kRLqzVEIE8NiouqnTvt6i8Bvc5PQ + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: + - application/xml response: status: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Mon, 27 Apr 2020 06:50:18 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4995' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - b6f1355d-d2c2-4a7d-86bd-792ebfa6c10f content-length: - - '669' + - '13749' + expires: + - Tue, 28 Apr 2020 23:39:29 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Tue, 28 Apr 2020 23:39:29 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OKJ000001f6273477-e0d6-4122-b3ff-8373f285aaa7Internal - TimeUse this job to record your internal and non-billable - time for activities such as annual leave, sick leave, professional development, - staff meetings etc55426e7e-426e-4767-a1c6-881598689460Practice - IgnitionPlanned2020-04-20T00:00:002021-04-20T00:00:001cc99c1e-8cf7-4248-ab84-3e11126facbcTony - BrecknerJ000002cf698ae8-e995-4d51-bb36-585634796c9fSetup - and Conversion Steps55426e7e-426e-4767-a1c6-881598689460Practice - IgnitionPlanned2020-04-21T00:00:002020-05-05T00:00:001cc99c1e-8cf7-4248-ab84-3e11126facbcTony - Breckner + encoding: UTF-8 + string: |- + OKJ000014(Sample) Bookkeeping Monthly - Basic28 November, 2019 + https://demo.practiceignition.com/proposals/23531 + (Sample) Bookkeeping Monthly - Basic + + --------------- + + 28 November, 2019 + https://demo.practiceignition.com/proposals/23530 + (Sample) Bookkeeping Monthly - Basic24097642ABC Co23531Planned2019-11-01T00:00:002019-11-07T00:00:0040615371859317Ed Minn859317Ed MinnJ000013(Sample) Bookkeeping Monthly - Basic28 November, 2019 + https://demo.practiceignition.com/proposals/23530 + (Sample) Bookkeeping Monthly - Basic24097642ABC Co23531Planned2019-11-08T00:00:002019-11-14T00:00:0040615370859317Ed Minn859317Ed MinnJ000016(Sample) Bookkeeping Monthly - Basic28 November, 2019 + https://demo.practiceignition.com/proposals/23530 + (Sample) Bookkeeping Monthly - Basic24097642ABC Co23531Planned2019-11-15T00:00:002019-11-21T00:00:0040615382859317Ed Minn859317Ed MinnJ000015(Sample) Bookkeeping Monthly - Basic28 November, 2019 + https://demo.practiceignition.com/proposals/23530 + (Sample) Bookkeeping Monthly - Basic24097642ABC Co23531Planned2019-11-22T00:00:002019-11-28T00:00:0040615373859317Ed Minn859317Ed MinnJ000012(Sample) Client Review Quarterly27 November, 2019 + https://demo.practiceignition.com/proposals/23499 + (Sample) Client Review Quarterly + + --------------- + + 27 November, 2019 + https://demo.practiceignition.com/proposals/23498 + (Sample) Client Review Quarterly24097642ABC Co23499Planned2020-01-01T00:00:002020-01-07T00:00:0040590048859317Ed Minn859317Ed MinnJ000022Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044305753J000023Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044306866J000024Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044309157J000025Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044309165J000026Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044310517J000027Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044310566J000028Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044313368J000029Brochure DesignDetailed description of the job24097642ABC CoPlanned2029-10-23T00:00:002029-10-28T00:00:0044346180J000003(Sample) Annual Accounts and Tax Return15 October, 2019 + https://pi-review-pr-10033.herokuapp.com/proposals/1 + (Sample) Annual Accounts and Tax Return23526538Client 61Planned2020-01-01T00:00:002020-12-31T00:00:0039501788J000004(Sample) Addon << integration_name >>, Setup and Training07 November, 2019 + http://localhost:3000/proposals/4 + (Sample) Addon << integration_name >>, Setup and Training23864530Ian Example Client4Planned2019-07-01T00:00:002020-06-30T00:00:0040150666J000005(Sample) Addon << integration_name >>, Setup and Training11 November, 2019 + http://localhost:3000/proposals/6 + (Sample) Addon << integration_name >>, Setup and Training23864530Ian Example Client6Planned2019-07-01T00:00:002020-06-30T00:00:0040229141J000006(Sample) Addon << integration_name >>, Setup and Training11 November, 2019 + http://localhost:3000/proposals/7 + (Sample) Addon << integration_name >>, Setup and Training23864530Ian Example Client7Planned2019-07-01T00:00:002020-06-30T00:00:0040232745J000007(Sample) Annual Accounts and Tax Return11 November, 2019 + http://localhost:3000/proposals/8 + (Sample) Annual Accounts and Tax Return23864530Ian Example Client8Planned2019-07-01T00:00:002020-06-30T00:00:0040233555J000008(Sample) Addon << integration_name >>, Setup and Training11 November, 2019 + http://localhost:3000/proposals/9 + (Sample) Addon << integration_name >>, Setup and Training23864530Ian Example Client9Planned2019-07-01T00:00:002020-06-30T00:00:0040233593J000009(Sample) Bookkeeping Monthly - Basic12 November, 2019 + http://localhost:3000/proposals/10 + (Sample) Bookkeeping Monthly - Basic23864530Ian Example Client10Planned2019-07-01T00:00:002020-06-30T00:00:0040306029J000010(Sample) Ledger Conversion, Setup and Training - (Sample) Client Review Quarterly12 November, 2019 + http://localhost:3000/proposals/11 + (Sample) Ledger Conversion, Setup and Training - (Sample) Client Review Quarterly23864530Ian Example Client11Planned2019-07-01T00:00:002020-06-30T00:00:0040306035J000011(Sample) Annual Accounts and Tax Return14 November, 2019 + http://localhost:3000/proposals/13 + (Sample) Annual Accounts and Tax Return23864530Ian Example Client13Planned2019-07-01T00:00:002020-06-30T00:00:0040317608J000017(Sample) Addon << integration_name >>, Setup and Training07 January, 2020 + http://localhost:3000/proposals/191 + (Sample) Addon << integration_name >>, Setup and Training23864530Ian Example Client191Planned2019-07-01T00:00:002020-06-30T00:00:0041443427J000001Internal TimeUse this job to record your internal and non-billable time for activities such as annual leave, sick leave, professional development, staff meetings etc23403717Practice Ignition - XPM Product & Development Testing AccountPlanned2019-09-30T00:00:002020-09-30T00:00:0039186188858948Patrick FrigoJ000002Setup and Conversion Steps23403717Practice Ignition - XPM Product & Development Testing AccountPlanned2019-10-01T00:00:002019-10-15T00:00:0039186189858948Patrick FrigoJ000018(Sample) Addon << integration_name >>, Setup and Training20 January, 2020 + http://localhost:3000/proposals/194 + (Sample) Addon << integration_name >>, Setup and Training23702571Space Ranger194Planned2019-07-01T00:00:002020-06-30T00:00:0041684984J000019(Sample) Addon << integration_name >>, Setup and Training20 January, 2020 + http://localhost:3000/proposals/193 + (Sample) Addon << integration_name >>, Setup and Training23702571Space Ranger193Planned2019-07-01T00:00:002020-06-30T00:00:0041695592J000020(Sample) Annual Accounts and Tax Return14 February, 2020 + http://localhost:3000/proposals/189 + (Sample) Annual Accounts and Tax Return23702571Space Ranger189Planned2019-07-01T00:00:002020-06-30T00:00:0042339558J000021service 124 March, 2020 + http://localhost:3000/proposals/17 + service 123702571Space Ranger17Planned2019-07-01T00:00:002020-06-30T00:00:0043375546 http_version: null - recorded_at: Mon, 27 Apr 2020 06:50:19 GMT + recorded_at: Tue, 28 Apr 2020 23:39:29 GMT recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/staff/list.yml b/spec/vcr_cassettes/xpm_ruby/staff/list.yml index 51ec1ce..dc2f1c0 100644 --- a/spec/vcr_cassettes/xpm_ruby/staff/list.yml +++ b/spec/vcr_cassettes/xpm_ruby/staff/list.yml @@ -2,43 +2,59 @@ http_interactions: - request: method: get - uri: https://api.workflowmax.com/v3/staff.api/list + uri: https://api.xero.com/practicemanager/3.0/staff.api/list body: encoding: US-ASCII string: '' headers: - Authorization: - - Basic TEST User-Agent: - Faraday v1.0.1 + Authorization: + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMTc2NDQsImV4cCI6MTU4ODExOTQ0NCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODA1MTE0MywieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6IjQzMGI0ZmVmMWI0NjQ2MGZiMTgwOWNmNmQ5OWJhODIxIiwianRpIjoiMmI3NGQxZDZhMzcxNDlhN2VjNjkwNmM2NGM0MDFlMjEiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.HhzdzozbWidNt8ugO43wPpJhh1H_52khXAxzfwiyXn4r9eBO2qFrYNbVHliDzQrWNurTWnnWttWomCOjfaXpJ0h5m85r6H2h0_nUvd6OnNDEl6yD5Lfqfk1TxbxkEOu2UlJq8pFgeq4dLP9QUpjmJG2cff4bGu809uGDO-lARX1MhZOCUzVCJWdOClZlPivu-zwp8vMDItGCrt-HY8v874X8PNhqiX9aSwZIRzuyNfd71ok0VbGvLeoAxkY-Ph4NdAs-Gvn21S_6-9dIPohtxthqPxDJA3FOJBbQ_OL4y35EkaN3IlNp8J3WILIbjz541OHFCd6nBPGHuByGNMZslg + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: + - application/xml response: status: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Mon, 27 Apr 2020 02:07:18 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4994' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - e4487879-7b32-4ecf-b340-4483c145be02 content-length: - - '369' + - '1794' + expires: + - Tue, 28 Apr 2020 23:48:01 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Tue, 28 Apr 2020 23:48:01 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OKaa93a24c-0633-4885-b104-7b4e43cc702eJane Doejane@test.com
1cc99c1e-8cf7-4248-ab84-3e11126facbcJohn Doejohn@test.com
+ encoding: UTF-8 + string: OK859230Dev + Testingdev@practiceignition.com
859317Ed + Minnluis+edminn@practiceignition.com
858949Jana + Paulechjana@practiceignition.com
859231Nick + Daintynick@practiceignition.com
863967Nick + Daintynick+xpmtest2@practiceignition.com
858948Patrick + Frigopatrick.frigo@xero.com
859319Patty + Igneousluis@practiceignition.com
859318Some + Usersome_user@pattyrocks.com
863927Testchris@practiceignition.com
866437testadammikulas@gmail.com
http_version: null - recorded_at: Mon, 27 Apr 2020 02:07:19 GMT + recorded_at: Tue, 28 Apr 2020 23:48:01 GMT recorded_with: VCR 5.1.0 diff --git a/spec/vcr_cassettes/xpm_ruby/template/list.yml b/spec/vcr_cassettes/xpm_ruby/template/list.yml index 0973535..c39c729 100644 --- a/spec/vcr_cassettes/xpm_ruby/template/list.yml +++ b/spec/vcr_cassettes/xpm_ruby/template/list.yml @@ -2,53 +2,60 @@ http_interactions: - request: method: get - uri: https://api.workflowmax.com/v3/template.api/list + uri: https://api.xero.com/practicemanager/3.0/template.api/list body: encoding: US-ASCII string: '' headers: - Authorization: - - Basic TEST= User-Agent: - Faraday v1.0.1 + Authorization: + - Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjFDQUY4RTY2NzcyRDZEQzAyOEQ2NzI2RkQwMjYxNTgxNTcwRUZDMTkiLCJ0eXAiOiJKV1QiLCJ4NXQiOiJISy1PWm5jdGJjQW8xbkp2MENZVmdWY09fQmsifQ.eyJuYmYiOjE1ODgxMTc2NDQsImV4cCI6MTU4ODExOTQ0NCwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS54ZXJvLmNvbSIsImF1ZCI6Imh0dHBzOi8vaWRlbnRpdHkueGVyby5jb20vcmVzb3VyY2VzIiwiY2xpZW50X2lkIjoiNDkyMjZBNjIzMzY0NDVFM0FGQUM5QTQ4MkJGOUUyN0UiLCJzdWIiOiIwY2FmMWU4MWYyZWE1MzdkYWIxYjYzNTY3NTc2ZDk3ZSIsImF1dGhfdGltZSI6MTU4ODA1MTE0MywieGVyb191c2VyaWQiOiJmYzI5MDBjNy0wNjcyLTQzOGItOTNkMS1hOGMyNTBmZDg5MjkiLCJnbG9iYWxfc2Vzc2lvbl9pZCI6IjQzMGI0ZmVmMWI0NjQ2MGZiMTgwOWNmNmQ5OWJhODIxIiwianRpIjoiMmI3NGQxZDZhMzcxNDlhN2VjNjkwNmM2NGM0MDFlMjEiLCJzY29wZSI6WyJlbWFpbCIsInByb2ZpbGUiLCJvcGVuaWQiLCJwcmFjdGljZW1hbmFnZXIiLCJvZmZsaW5lX2FjY2VzcyJdfQ.HhzdzozbWidNt8ugO43wPpJhh1H_52khXAxzfwiyXn4r9eBO2qFrYNbVHliDzQrWNurTWnnWttWomCOjfaXpJ0h5m85r6H2h0_nUvd6OnNDEl6yD5Lfqfk1TxbxkEOu2UlJq8pFgeq4dLP9QUpjmJG2cff4bGu809uGDO-lARX1MhZOCUzVCJWdOClZlPivu-zwp8vMDItGCrt-HY8v874X8PNhqiX9aSwZIRzuyNfd71ok0VbGvLeoAxkY-Ph4NdAs-Gvn21S_6-9dIPohtxthqPxDJA3FOJBbQ_OL4y35EkaN3IlNp8J3WILIbjz541OHFCd6nBPGHuByGNMZslg + xero-tenant-id: + - '0791dc22-8611-4c1c-8df7-1c5453d0795b' + content_type: + - application/xml response: status: code: 200 message: OK headers: - access-control-allow-origin: - - "*" - cache-control: - - private content-type: - text/xml; charset=utf-8 - date: - - Mon, 27 Apr 2020 05:44:32 GMT server: - - Microsoft-IIS/10.0 - vary: - - Accept-Encoding - x-aspnet-version: - - 4.0.30319 - x-aspnetmvc-version: - - '4.0' + - Kestrel + x-daylimit-remaining: + - '4993' + x-minlimit-remaining: + - '59' + xero-correlation-id: + - b39cac4b-26ce-4fea-a65e-89804077699d content-length: - - '724' + - '819' + akamai-age-ms: + - '1588118029828' + expires: + - Tue, 28 Apr 2020 23:53:49 GMT + cache-control: + - max-age=0, no-cache, no-store + pragma: + - no-cache + date: + - Tue, 28 Apr 2020 23:53:49 GMT connection: - keep-alive + x-client-tls-ver: + - tls1.3 body: - encoding: ASCII-8BIT - string: OK