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

Use keyword-args#20

Merged
danielrose7 merged 2 commits into
privateprep:masterfrom
bezoar17:feat-keyword-args
May 18, 2018
Merged

Use keyword-args#20
danielrose7 merged 2 commits into
privateprep:masterfrom
bezoar17:feat-keyword-args

Conversation

@bezoar17
Copy link
Copy Markdown
Contributor

@bezoar17 bezoar17 commented Mar 22, 2018

Contributor Self-Check:

  • My commits and messages are solid
  • I have included tests that check success and failure
  • I have updated the README as appropriate

Which GitHub Issues does this PR address?

None

What does this PR do?

Clean up the gem's API to use keyword arguments for read requests.

How do I manually test this?

The test cases have been updated acc to the changes.

GIF for how this PR makes me feel

Note: This is a breaking change

Function definition takes in (object_type: , parameters: ) as input.

Previous create calls were as following

request.create(:CUSTOMER, {
  CUSTOMERID: '1',
  FIRST_NAME: 'Han',
  LAST_NAME: 'Solo',
  TYPE: 'Person',
  EMAIL1: 'han@solo.com',
  STATUS: 'active'
})

From now on, the requests pass arguments explicitly as following

request.create(object_type: :CUSTOMER, parameters: {
  CUSTOMERID: '1',
  FIRST_NAME: 'Han',
  LAST_NAME: 'Solo',
  TYPE: 'Person',
  EMAIL1: 'han@solo.com',
  STATUS: 'active'
})

As the read requests don't need an object_type, a read request would look like following

request.readMore(object_type: nil, parameters: {resultId: result_id})

The default value for object_type is nil so read requests can also be called like following

request.readMore(parameters: {resultId: result_id})
@bezoar17
Copy link
Copy Markdown
Contributor Author

@danielpowell4 , please have a look at this PR. Don't know if any changes are needed for the specific functions like create_customer , create_employee etc. I only use read request so haven't really gone through specific create, update flows. Also as this will be a breaking change, let me know what is needed from my side to ensure smooth release.

@danielrose7
Copy link
Copy Markdown
Contributor

@bezoar17 Thanks for this!

My first impression is that this is good to go. I am going to need a bit of time to dive in and make sure I'm 1000% confident in terms of how it looks and interacts with the rest of the gem.

Will report back when possible

@bezoar17
Copy link
Copy Markdown
Contributor Author

Cool, no hurries. This will be a breaking and possibly big change.

@danielrose7
Copy link
Copy Markdown
Contributor

danielrose7 commented Apr 3, 2018

@bezoar17 Spoke to @jzornow and confirmed that this looking 👍

Much of the seeming "create" code supported Intacct's DTD 2.1 syntax and is actually dead now

I want to run a few tests and do some cleanup later on this week but think it will likely be good to go as is. As this will result in a fairly sizeable change to the API, might be smart to bump the version to 2.0 when the release is ready

Thanks again for this!

@danielrose7 danielrose7 merged commit 6f970a1 into privateprep:master May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants