Skip to content

Commit

Permalink
Merge branch 'master' of github.com:marciniwanicki/OCGoogleDirectionsAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Iwanicki committed Mar 3, 2015
2 parents fe64f19 + 772378a commit f2574ba
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ It's really simple. To get directions you need to do <b>4 easy steps</b>.
#import <OCGoogleDirectionsAPI/OCGoogleDirectionsAPI.h>
````

2. Secondly you must provide your Google API Key. The method `application:didFinishLaunchingWithOptions:` in AppDelegate seams to be a good place for this code.
2. Secondly you can provide your Google API Key. The method `application:didFinishLaunchingWithOptions:` in AppDelegate seams to be a good place for this code.
However the API Key is now optional. Please check [API Key section](https://developers.google.com/maps/documentation/directions/#api_key) to decide if you need the key or not.

```objc
[OCDirectionsAPIClient provideAPIKey:@"<YOUR KEY>"];
[OCDirectionsAPIClient provideAPIKey:@"<YOUR API KEY>"];
```
3. Prepare a `OCDirectionsRequest` object to specify route(s) you want to retrieve from the service.
```objc
OCDirectionsRequest *request = [OCDirectionsRequest requestWithOriginString:@"<ORIGIN>" andDestinationString:@"<DESTINATION>" sensor:NO];
OCDirectionsRequest *request = [OCDirectionsRequest requestWithOriginString:@"<ORIGIN>" andDestinationString:@"<DESTINATION>"];
```

4. Create an instance of `OCDirectionsAPIClient` and call `directions:response:` method to retrieve required data (`OCDirectionsResponse`) asynchronously.
Expand All @@ -60,6 +61,16 @@ It's really simple. To get directions you need to do <b>4 easy steps</b>.
// some code
}];
```
Some init methods of `OCDirectionsAPIClient`:
```objc
- (instancetype)initWithKey:(NSString *)key;
- (instancetype)initWithNoKeyUseHttps:(BOOL)useHttps;
- (instancetype)initWithKey:(NSString *)key useHttps:(BOOL)https;
```

<b>Sequence diagram</b>

Expand All @@ -74,12 +85,20 @@ That's all! It's quite easy, isn't it? If you like to know a bit more about requ
To create an isntance of `OCDirectionsRequest` you can use one of the following factory methods.

```objc
+ (instancetype)requestWithOriginLocation:(CLLocation *)origin andDestinationLocation:(CLLocation *)destination;

+ (instancetype)requestWithOriginLocation:(CLLocation *)origin andDestinationLocation:(CLLocation *)destination sensor:(BOOL)sensor;

+ (instancetype)requestWithOriginString:(NSString *)origin andDestinationLocation:(CLLocation *)destination;

+ (instancetype)requestWithOriginString:(NSString *)origin andDestinationLocation:(CLLocation *)destination sensor:(BOOL)sensor;

+ (instancetype)requestWithOriginLocation:(CLLocation *)origin andDestinationString:(NSString *)destination;

+ (instancetype)requestWithOriginLocation:(CLLocation *)origin andDestinationString:(NSString *)destination sensor:(BOOL)sensor;

+ (instancetype)requestWithOriginString:(NSString *)origin andDestinationString:(NSString *)destination;

+ (instancetype)requestWithOriginString:(NSString *)origin andDestinationString:(NSString *)destination sensor:(BOOL)sensor;
```

Expand Down

0 comments on commit f2574ba

Please sign in to comment.