FirehoseCocoa 0.0.1

FirehoseCocoa 0.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Adam Kirk.



 
Depends on:
MTPocket~> 1.1.0
MTDates~> 0.9.2
 

  • By
  • Adam Kirk

Library for interacting with the Firehose Customer Support API.

NOTICE!!!!! The service this library interacts with is not yet launched, so do not use this library yet. It currently only for the Mysterious Trousers team.

Installation

  1. Clone this repo [somewhere]
  2. In your Podfile, add this line:
pod "FirehoseCocoa", local: "[somewhere]"

pod? => https://github.com/CocoaPods/CocoaPods/

Example Usage

Set the environment:

[[FHClient sharedClient] setEnvironment:FHEnvironmentTesting];

Sign up an agent:

FHAgent *agent = [FHAgent agentWithEmail:[MTFaker email] password:[MTFaker password]];
MTPocketResponse *response = [agent signupWithFirstName:[MTFaker name] lastName:[MTFaker name]];

View an agents companies:

FHCompany *company = [agent.companies lastObject];
company.title;    // => @"My Company"

Fetch a companies customers:

FHRemoteArray *customers = [_company customersMatchingResolvedFilter:FHCustomerResolvedFilterEverything
                                                   channelFilter:FHCustomerChannelFilterAll
                                                    searchString:nil
                                                            sort:FHCustomerSortNewestFirst];
MTPocketResponse *response = [customers next];
if (response.success) {
  for (FHCustomer *customer in customers) {
    customer.name;    // => @"Adam Kirk"
  }
}

Fetch a customers interactions:

FHRemoteArray *interactions = customer.interactions;
MTPocketResponse *response = [interactions next];
if (response.success) {
  for (FHInteraction *interaction in interactions) {
    interaction.body;   // => @"Hi there, I need help with something...""

    for (FHNote *note in interaction.notes) {
      note.body;  // => @"This is a note about this interaction"
    }
  }
}

Testing

First init the submodules

git submodule update --init --recursive

NOTE: If you are not a coder of Mysterious Trousers, don't try unit testing this yet. Still working on the best way to let anyone test it.

Replace the missing constants.h file with the following contents:

#define BASE_URL_LOCAL        @""
#define BASE_URL_TESTING      @""
#define BASE_URL_TUNNEL       @""
#define BASE_URL_STAGING      @"https://firehosestaging.herokuapp.com/"
#define BASE_URL_PRODUCTION   @"https://api.firehoseapp.com/"
#define ENV_ENUM              FHEnvironmentStaging