giftbit-rails Gem

Wrapper for Giftbit API

Installation

Add this line to your application's Gemfile:

gem 'giftbit-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install giftbit-rails

Usage

Initialize Giftbit request in your app

Giftbit::Request.new(your_api_key, your_api_url)

Ping

response = Giftbit::Ping.ping

Brand

List all Brands

response = Giftbit::Brand.all

Retrieve Brand

response = Giftbit::Brand.find(id: 'brand_code')

Region

List all Regions

response = Giftbit::Region.all

Campaign

Create Campaign (params can be found here)

response = Giftbit::Campaign.create({
                                      "gift_template": "XDKHE",
                                      "contacts": [
                                        {
                                          "firstname": "Perry",
                                          "lastname": "Johnson",
                                          "email": "[email protected]"
                                        },
                                        {
                                          "firstname": "Rita",
                                          "lastname": "Robson",
                                          "email": "[email protected]"
                                        }
                                      ],
                                      "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')

Embedded

Create Embedded Gift (params can be found here)

response = Giftbit::Embedded.create({

                                      "contact": {
                                                    "firstname": "Perry",
                                                    "lastname": "Johnson",
                                                    "email": "[email protected]"
                                                  },
                                      "price_in_cents": 5000,
                                      "brand_code": "itunesus",
                                      "id": "clientProvidedGiftId_abc123"})

Funds

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"
                                })

Gifts

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')

Marketplace

response = Giftbit::Marktetplace.all    

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the giftbit-rails project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.