Wrapper for Giftbit API
Add this line to your application's Gemfile:
gem 'giftbit-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install giftbit-rails
Initialize Giftbit request in your app
Giftbit::Request.new(your_api_key, your_api_url)
response = Giftbit::Ping.ping
List all Brands
response = Giftbit::Brand.all
Retrieve Brand
response = Giftbit::Brand.find(id: 'brand_code')
List all Regions
response = Giftbit::Region.all
Create Campaign (params can be found here)
response = Giftbit::Campaign.create({
"gift_template": "XDKHE",
"contacts": [
{
"firstname": "Perry",
"lastname": "Johnson",
"email": "pjohnson@giftbit.com"
},
{
"firstname": "Rita",
"lastname": "Robson",
"email": "rrobson@giftbit.com"
}
],
"price_in_cents": 5000,
"brand_codes": [
"itunesus",
"amazonus"
],
"expiry": "2018-11-01",
"id": "clientProvidedGiftId_abc123"
})
Retrieve Campaign by id or uuid
Using id
response = Giftbit::Campaign.find(id: 'campaign_id')
Using uuid
response = Giftbit::Campaign.find(uuid: 'campaign_uuid')
Create Embedded Gift (params can be found here)
response = Giftbit::Embedded.create({
"contact": {
"firstname": "Perry",
"lastname": "Johnson",
"email": "pjohnson@giftbit.com"
},
"price_in_cents": 5000,
"brand_code": "itunesus",
"id": "clientProvidedGiftId_abc123"})
Retrieve funding information
response = Giftbit::Fund.all
Add funds through Credit Card (params can be found here)
response = Giftbit::Fund.create({
"currencyisocode": "USD",
"fund_amount_in_cents": 25000,
"id": "clientProvidedId_abc123"
})
List all Gifts (params can be found here)
response = Giftbit::Gift.all
Retrieve a particular Gift
response = Giftbit::Gift.find(uuid: 'gift_uuid')
Resend Gift
response = Giftbit::Gift.resend(uuid: 'gift_uuid', resend: true)
Cancel Gift
response = Giftbit::Gift.cancel(uuid: 'gift_uuid')
Retrieve shortlinks by id or uuid
Using id
response = Giftbit::Link.find(id: 'link_id')
Using uuid
response = Giftbit::Link.find(uuid: 'link_uuid')
response = Giftbit::Marktetplace.all
Bug reports and pull requests are welcome on GitHub at https://github.com/fakhir-shad/giftbit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the giftbit-rails project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.