Marble API Client
This library exists to simplify requests made to Marble Service Model (Still in progress). It offers simple objects to comply with the Marble Service Model request and response objects. The library currently supports:
- Create
- Index
Installation
To install through Rubygems:
gem install install marble_api_client
You can also add this to your Gemfile:
bundle add marble_api_client
Examples
Creating the client
A client can be created with a URL and any headers that should be included in all requests. By default, Content-Type of Application/JSON is added.
client = MarbleApiClient.client(
'https://www.example.com:3000'
)
Making Request Objects
Create
create_request_obj = Requests::Create.new(context: { key: 'value' },
record: { key: 'value' })
Index
index_request_obj = Requests::Index.new(context: { key: 'value' },
record: { key: 'value' },
page: 1,
page_size: 25)
Using the Client:
Create
create_response = client.create('custom/path',
create_request_obj,
headers)
Index
index_response = client.index('custom/path',
index_request_obj,
headers)
Response Objects
Responses will be one of these response objects:
- Success
- BadRequest
- Unauthorized
- Forbidden
- NotFound
- UnprocessableEntity
- ServerError
- NotImplemented
Contributing
Development Environment Configuration
Basic steps to take to get this repository compiling:
- Install Ruby (check marble_api_client.gemspec for versions supported)
- Install bundler (gem install bundler)
- Clone the repository (git clone [email protected]:bluemarblepayroll/marble_api_client.git)
- Navigate to the root folder (cd marble_api_client)
- Install dependencies (bundle)
Running Tests
To execute the test suite run:
bundle exec rspec spec --format documentation
Alternatively, you can have Guard watch for changes:
bundle exec guard
Also, do not forget to run Rubocop:
bundle exec rubocop
Publishing
Note: ensure you have proper authorization before trying to publish new versions.
After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:
- Merge Pull Request into master
- Update
lib/marble_api_client/version.rb
using semantic versioning - Install dependencies:
bundle
- Update
CHANGELOG.md
with release notes - Commit & push master to remote and ensure CI builds master successfully
- 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.
Code of Conduct
Everyone interacting in this codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
License
This project is MIT Licensed.