Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rockwotj/google-cloud-endpoints-client

Cocoa Pod for the Google Cloud Endpoints Client Library
https://github.com/rockwotj/google-cloud-endpoints-client

Last synced: 8 days ago
JSON representation

Cocoa Pod for the Google Cloud Endpoints Client Library

Awesome Lists containing this project

README

        

# Google Cloud Endpoints Client Cocoa Pod

This is a CocoaPod of the [GTL Client library](https://code.google.com/p/google-api-objectivec-client/) that is used in Google Cloud Endpoint's generated client code. This is basically a way to automate [this](https://cloud.google.com/appengine/docs/python/endpoints/consume_ios#Python_Adding_required_files_to_your_iOS_project) step in the Google Cloud Endpoints setup process. This pod is automatically updated once a week, via a [script](https://gist.github.com/rockwotj/77dcb7fc64c64cd21f4c).

I hope this makes your life a little easier!

## Installation

google-cloud-endpoints-client is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'google-cloud-endpoints-client', :git => 'https://github.com/rockwotj/google-cloud-endpoints-client.git'
```

## How to set up Google Cloud Endpoints with this pod

These steps are repeated from the iOS course [here](http://www.rosebotics.org/courses), which are generalized versions of [Google's steps](https://developers.google.com/appengine/docs/python/endpoints/consume_ios).

### Step 1 - Add two frameworks
The first step is easy. Add two frameworks to the project:

1. Security.framework
1. SystemConfiguration.framework

### Step 2 - Add the Cocoa Pod
Add this to your pods file
```ruby
pod 'google-cloud-endpoints-client', :git => 'https://github.com/rockwotj/google-cloud-endpoints-client.git'
```
then
```shell
pod install
```

### Step 3 - Generate the files for your backend
This is a two step process

1. Create a file that is called the discovery document
1. Feed that discovery document to an executable called ServiceGenerator (note, you’ll need to compile that binary from the source code before you can use it!)

Creating the discovery document

In the root directory of your appengine project (where app.yaml is located) run the following command (assuming your api is all in one class)
```shell
endpointscfg.py get_discovery_doc -f rpc .
```

This should output a file called: \.discovery

Using and compiling the ServiceGenerator

Check out [GTL Client library](https://code.google.com/p/google-api-objectivec-client/) using
```shell
svn checkout https://code.google.com/p/google-api-objectivec-client/
```
Then open the ServiceGenerator.xcodeproj in X-Code (it’s in this folder… Source → Tools → ServiceGenerator → ServiceGenerator.xcodeproj) and then hit Project->Build or ⌘B

After it is built, using the full path of the executable run this command within the root directory of you appengine project
```shell
/your/full/path/to/ServiceGenerator ./.discovery --outputDir ./API
```
Your entire API was created and placed into the ./API folder. Copy all of the files EXCEPT THE FILE \_Sources.m into X-Code.

After that, if you use Swift, like I do, add this import to your Bridging Header
```objc
#import "GTL.h"
```

Then you're all ready to roll! It is still a lot of work, but at least the pod speeds up one of those steps.

## Author

Tyler Rockwood (rockwotj)

## License

Google Cloud Endpoints Client is available under the MIT license. See the LICENSE file for more info.