This gem provides access to the Flybuy REST API. Documentation for this API can be found here
This is a work-in-progress. Not all API funcionality is currently available in this gem.
Add this line to your application's Gemfile:
gem 'flybuy'And then execute:
$ bundle install
Or install it yourself as:
$ gem install flybuy
Initialize the gem with your API token:
Flybuy.token=[YOUR_TOKEN]Flybuy::Site::allFlybuy::Site::find(site_id)Flybuy::Site::find_by_partner_identifier(partner_identifier)These are the required attributes. You can send any of the other attributes listed in the documentation.
Flybuy::Site.create(
{
project_id: 100,
name: 'My Site',
partner_identifier: '1234',
full_address: '821 Hillcrest Lane, Elsinore, CA 92330',
phone: '951-245-1835',
latitude: 44.574352,
longitude: -81.193817,
timezone: 'America/Los_Angeles',
}
)Flybuy::Site.update(
id: 2945,
attributes: {
name: 'My Site',
}
)The result of Flybuy::Site::all. This is an array with two additional methods:
sites_list.find(partner_identifier)sites_list.liveFlybuy::Order::find(order_id)Flybuy::Order::find_by_partner_identifier(partner_identifier)Flybuy::Order::create(**kwargs)order.update(**kwargs)order.update_order_state(new_state)order.update_customer_state(new_state)order.update_order_state(longitude: 34.23, latitude: -8.05)Check if pickup is currently available for this order (using SiteStoreHours) (with a Flybuy::Order object)
order.pickup_currently_open?Flybuy::OrderEvent.update_order_state(order_id: id, order_state: new_state)Flybuy::OrderEvent.update_customer_state(order_id: id, order_state: new_state)Flybuy::ArchivedOrder.find_by_partner_identifier(partner_identifier, date_range)Flybuy::WebhookAuthentication.new(request).authentic?(token='token', hmac_key='base64 key')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.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruby-flybuy-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.