Ruby client wrapper for the API at https://api.swgoh.help .
Gemfile:
gem 'SWGOH-API', '~> 1.0.0'
Install:
gem install SWGOH-API
# Require the gem
require 'SWGOH/API/CLIENT/client'
# Create a new client
client = CLIENT.new
# Generate a new access_token
access_token = client.authorize("username", "password")
# Or authenticate with a saved access_token
client.access_token = access_token
# Then start making requests
json = client.get_players([123456789])
After checking out the repo, run bin/setup
to install dependencies.
To build your changes, run gem build SWGOH-API.gemspec
To install the build onto your local machine, run gem install 'SWGOH-API'
.
$ irb
irb(main):001:0> require 'SWGOH/API/CLIENT/client'
=> true
irb(main):002:0> client = CLIENT.new
=> #<CLIENT:0x00007fdf90087b28 @language="ENG_US", @enums=false, @structure=false, @access_token=nil>
irb(main):003:0> client.authorized?
=> false
irb(main):004:0> client.access_token = 'myexistingtoken'
=> "myexistingtoken"
irb(main):005:0> client.authorized?
=> true
Run rake test
to run the unit tests.
These are the steps to create and tag a new version, push git commits and tags, and push the new gem version to rubygems.org.
version.rb
, and the README.mdgem build SWGOH-API.gemspec
to build the new gem versionbundle exec rake release
bundle exec rake release
Bug reports and pull requests are welcome on GitHub at https://github.com/jquass/SWGOH-API. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the SWGOH::API project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.