PostGraphile and Swift (SwiftUI) Integration - ios

I am looking to build a client for a website, the api the website provides is with postGraphile https://api.twetch.app/v1/graphiql . I have been struggling to integrate this with Swift. If anyone has any resources on this it would be greatly appreciated!

If you want a full GraphQL client on iOS the easiest way is Apollo iOS
There is a little bit of setup but it will let you query your API easily and give you auto completion and caching strategies.
You can of course query the API manually too but it will require quite a bit more work.

Related

Ruby resources for messenger bot?

We are creating a messenger bot with rails and are looking for some gens
We found Lita which looks nice but I wanted to know if there was any other cool ruby resources we might use for the project?
Thanks!
Here are a few.
Botstack is built on Rails with some pretty nice features like supporting webviews and help with web scraping.
https://github.com/davidmann4/botstack
I've built a messenger client that is pretty alpha but it is also fairly complete and I feel, nice to use.
https://github.com/pferdefleisch/messenger_client
Here is another pretty complete library that provides you with some request handlers as well as a messenger client. I believe it is used in botstack.
https://github.com/hyperoslo/facebook-messenger
This should get you started. I'm working on my own framework and will update the answer if I ever get it released.

Suggestions and information about SQL And Swift

I am working on a new app, until now i used firebase as database but this app will save much complex data and i think that firebase and noSQL at all is not the right solution in here.
I ran into this Pod: https://github.com/IBM-Swift/Swift-Kuery that helps to use PostgreSQL on swift.
I also ran into ElephantSQL that helps you to load PostgreSQL on an AWS server (if i got it right), but i found it pretty hard to understand everything about it and I'm not sure that this is the best solution for me.
I would love to get some help from somebody that know more on SQL and SWIFT and could help me to choose right services to use it.
Thank you very much.
My suggestion to you is to avoid doing the SQL right from the mobile App unless this is extremely needed (till now I haven't found a reason to do it).
It's a better design to expose your data from your backend server (AWS, Azure, Hosted, etc) with a Webservice/API. For this you can use any backend language. Depending on your needs you could use vapor which is a web framework based on swift so that you wouldn't have to learn another language.

Angular 2 and Rails as a separate applications

Who can tell to me how to create a 2 separate applications: rails backend and Angular 2 frontend and config the data exchange between it. Rails app need to work as a json api. How Angular 2 understand recieved data from rails and how we can send the concrete data to concrete component?
Please some links, articles and so on.
Thank you so much!
The Server
I'm not an expert in the field of ruby, but this tutorial looked good to me:
https://www.codementor.io/ruby-on-rails/tutorial/creating-simple-api-with-rails
The Client
Angular 2 belongs more to my strengths:
Follow up to the official tutorial from google to develope an angular2 app. here is the link:
https://angular.io/guide/quickstart
If you really understand how that starter-tutorial works, you might use a quick-start npm package for a faster start. Be warned! You only use a quick-start package, if you understand the plain way angular 2 should be installed!
The Clients API engine
For the API queries between your client (angular2) and your server (ruby) use this tutorial:
https://angular.io/docs/ts/latest/guide/server-communication.html
I would recommend you to develope only with TypeScript. Dont use EcmaScript (JavaScript) for your client! All the tutorials and the whole community are real hardcore typescript fanatics, so don't even try to convert them :D Just follow them! (To explain why, would take me another post...)
Good luck and have a nice start!
This is really at least two questions: 1) how can a static angularjs app consume json data 2) how can a rails server return json data. Both questions are best answered by simply learning the two frameworks. The harder questions are around designing the api and how to authenticate. All that is really too broad for a single answer except to say go and learn about those four concerns.

Titanium oAuth Request

I have a Titanium Appcelerator project and I am trying to incorporate an API that uses oAuth. I found an excellent implementation of oAuth in Titanium Appcelerator for SimpleGeo by Aaron Saunders over at his blog:
http://blog.clearlyinnovative.com/post/3321606289/titanium-appcelerator-quickie-oauth-and-simplegeo
It is extremely simplified and boiled down so I figured it would be easy to transfer the implementation to other APIs. In my case, I would like to extend it to Quizlet's API found here:
https://quizlet.com/api/2.0/docs/authorization_code_flow/
However, I am afraid I am just too new to oAuth in general that I don't even know where to begin, especially in how and what to do to the parameters. I'm hoping it's as simple as changing some parameters around.
It would be terrific if an expert could spare some time and maybe explain how I would go about adapting the implementation for Quizlet's API.
Thank you so much in advance. Please let me know if you would like me to paste in the code from Aaron's blog or do anything. I didn't want to clutter this post.

Getting started consuming web services in a Ruby on Rails 3 application

So I'm getting started learning Rails. Now that Rails 3 is out, I want to stick to learning the Rails 3 way of doing things. One of the things I want to learn how to do is how to consume web services / work with third party REST APIs / create "mashup" applications. I've only done minimal work like this with PHP and pre-built libraries.
Can someone please lead me to some resources, best practices, or give me a quick 101 lesson on how to start working with these types of APIs? What gems should I use? Some sample code to get me started would be much appreciated.
Update: I am specifically trying to use the Google Books API (non-authenticated). Since there is no client library for this API, I'm wondering how other Ruby/Rails developers are working with APIs that don't come with their own Ruby library. That's why I'm looking for a more generic solution to working with "fill in the blank" API.
Update: After some research, I noticed the Net::HTTP library. All the tutorials that talked about it were fairly old. Is this still the best library to use for consuming RESTful web services? Or is there a newer Gem that makes this easier? I just want to know which gem/library I should use, and how to work with the XML/JSON result that is returned.
Update: This presentation was really helpful. It mentions a bunch of different libraries and shows examples of some of the libraries mentioned below: http://www.slideshare.net/pengwynn/json-and-the-apinauts
I'm a pretty big fan of HTTParty.
It's an abstraction layer on top of Net::HTTP with a nice little DSL for consuming web services. Here's a good example of how easy it is to use.
It's not without some warts (lots of dependencies) but it's really the way to go if you're on the consuming side.
I'd recommend REST with Nokogiri:
http://railscasts.com/episodes/190-screen-scraping-with-nokogiri
Nokogiri works well with xml too, not just HTML.
Weary is a really neat DSL for consuming RESTful services.
Clearly inspired by HTTParty but a bit newer and a bit more concise.

Resources