Skip to content

shabirjan/FyberOfferTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fyber Offer Challenge

The code has been written in Swift version 3 and uses Cocoapods for installing dependencies.

This repository contain the code for the Fyber Offer Challenge, and contain 2 folders, OfferFramework folder contain code for the SDK that generate a Universal framework that can be integrated in the projects, and FyberOffer-Example contains a demo project using the SDK for fetching offers.

FyberOffer

This folder contain code for rudimentary SDK for fetching Offers from the Fyber Server after providing AppId, UserId and API Key. To generate the Universal Framework the following Steps has to be followed.

* Open OfferFramework.xcodeproj.
* Select Generic Device from the Deivce List.
* Click on Product and than Archive
* After some seconds the Orangizer will open, please wait couple of seconds and it will open the Finder window with the Project folder that will contain Universal framework.

Requirements

* Xcode 8, Swift 3 , iOS 10

To use this framework in your project you need to follow these steps

* Create new project in Xcode.
* Add `Podfile` and add `SwiftyJSON` and `CryptoSwift` in that `Podfile`
* Install the Pods and than open the project by using the pods workspace
* Drag the `OfferFramework.framework` (generated by following above steps) in your project
* Dont forget to add that framework in the embedded binaries as well.
* Open any ViewController class in which you want to show the Offers, add Import OfferFramework.

Use this example code to load offers

let options = FYBOfferOptions(appID: "provide app id", userID: "provide user id", securityToken: "provide api key")
let sdk = FyberOfferSDK(options: options)
sdk.delegate = self
sdk.loadOffers(parentController: self)
}

Delegates

These are the optional delegates that updates the Controller about the different events for loading offers

func offersDidLoad()
func offerDidLoadOnView(offer: FyberOfferModel)
func offersDidClose()
func offersRecevied(totalOffers: Int)
func offersLoadFailedWithError(error: String)
func userSelectedOffer(offer: FyberOfferModel)

Testing

This Project also include unit tests that check whether network calls are working fine or not and also whether the request parameters are generating correct url or not also contain test that check whether the ViewController is being loaded or not and chech the functionality of that Offer View Controller.

FyberOffer-Example

This folder contain a demo project that uses the OfferFramework to load the offers, please update the pods before using the demo project.

About

Simple SDK built for fetching Offers from Fyber

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published