how to use external API with rails - ruby-on-rails

After making a bunch of CRUD-like apps, I've decided to venture out a bit and play with APIS. The Riot game API seems pretty simple to implement, as it is just a link follow by my API key.
ex: https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/RiotSchmick?api_key=<key>
after googling for quite a while yesterday, I am still at lost how I can integrate this information.
Where should I put the above link, how do I store the information from the JSON, and how exactly does the MVC structure fit into this?
If I'm not storing any data (no users, just instant display of info based on API) Do I even need a database?

Related

Downloading Twitter corpus

I am working on a data mining system and one of the requirements is it being able to perform the analysis without the use of API. Is there a way to download the Twitter database (or a big part of it, at least) and work with it locally?
There is a paper about creating corpora from twitter. It is called “TWORPUS – An Easy-to-Use Tool for the Creation of Tailored Twitter Corpora”. I recommend to read it because it also covers licensing issues etc. They also provide there code on Github.
In fact, you cannot download the twitter data dumps directly. I can download single tweets and stored them in a corpus. But, it is also not allowed to share that data. Therefore, the authors built the Tworpus client to create private twitter corpora.
APIs are the official way of getting Twitter data and they work really well so it is not comprehensible why you do not want to use APIs. The web scraping is a work around but not recommended, in addition you would like to get a big part of it, so I do not think you will be satisfied with it. You can also buy the data from Gnip.

Can a Meteor web app serve data to an iOS app?

Pretty straight forward question i think. I have created a web app in meteor and its using mongoDB storage. I have UI to update the data in the backend through the web app.
The question then becomes, I have designed an iOS app that i would really love for it to read the data being served to the web app from the mongoDB. As it stands, the app takes a url to a JSON file that i update regularly and serializes it accordingly. I want to pass on the tasks of updating the backend but exposing company employees to the potential mess of JSON backend, where missing/deleting a bracket / brace causes the app to break is out of the question.
My question is, since the meteor web app stores data as JSON documents, is there a way i can access the same JSON from the iOS app? It would really help because then, the person updating the backend only deals with UI, not code. I know this is a pretty broad question, but any pointers would be fantastic. Links, tutorials, frameworks to learn... anything. I've been googling around but can't seem to find anything solid.
Thanks!
You'll want to look into using one of the many iOS based DDP clients, like this one. With these libraries you can connect native iOS apps to the backend of any deployed Meteor app.
As far as I understand, you are looking for a way to get/update the data of your meteor server from the IOS app.
To do that, you can expose an API, like a REST one. Basically, your IOS app will call your Meteor server via HTTP and send/receive JSON data. Like that, you can get your collections, update, add, delete their items as well. There is a lot of literature around REST.
I used a very old one that I do not recommend because it is not maintained anymore, I will put the link anyway Old Rest API.
I invite you to have a look at atmosphere, the meteor package library: Atmosphere. I did a quick search on it and I found this package that looks promising: Simple Rest.
Have a look at the packages on Atmosphere, you can use 'rest' as keyword and pick the one that fits your needs. I am especially thinking of security ;).

Big Picture — What sort of feed for an iOS news app?

Alright — this sort of question shows my naïveté but I am asking it nonetheless so I don't venture down the wrong rabbit hole while trying out this app.
I'm making what amounts to a news app. Imagine taking a Wordpress blog and fitting it to iOS. Now, here's my question — what sort of feed / architecture should I be using to push information from my Wordpress server to my app? I would assume RSS using AFNetworking, but that seems to cause some rough edges, and all tutorials that I see end up pushing to a web view instead of a scrollview with nice, rendered text. Plus, none of the same tutorials seem to have anything further than the initial feed (loading more than the initial 10 stories given, for example).
I've already committed a few hours to trying the RSS / AFNetworking approach, but is there a significantly better alternative that I just haven't come across. (Note that I do have access to the back-end of my Wordpress site, i.e. it isn't somebody else's)
If you are building an iOS app that connects to WordPress, I suggest you to access the website data by an API instead of feed, then you can hit the API from your app and manipulate the data as you want.
If you have access to the WordPress backend, check the Thermal API which is a plugin that will probably solve your problem.
Cheers,
I would suggest that you look at https://wordpress.org/plugins/json-rest-api/ this is to be added to the core of wordpress so it would seem that is the way to go I think.
By the way I am working on the same type of thing as you.
I think the most popular Wordpress API is the one that comes with Jetpack. You can find its documentation here: https://developer.wordpress.com/docs/api/
If you just want read access, then i think the easiest way to do so is by using: https://github.com/evermeer/AlamofireJsonToObjects/blob/master/AlamofireJsonToObjectsTests/WordpressTest.swift
If you also want write access, then you have to implement Oauth2. For that you can select a library from: https://cocoapods.org/?q=oauth

How would I create an app for a website that does not have an API and uses ASP.NET?

Basically what I'm looking to do is to create an native interface for a website that does not have any sort of API. This would be a 3rd party app that would provide all the same functionality of the website, just optimized for iOS. The real problem I run into is in sending and getting user-entered data to the website as it is using ASP.NET which I am not at all familiar with and the user would need to log-in to the website.
This is kind of a convoluted question, but I am sitting at square one and not even really sure where to go from here.
It sounds like you are asking if you can create an iOS app that can interact with another website that doesn't have an API? If my understanding is correct, then there's really only one option I can think of.
You would have to make your iOS app make HTTP(S) calls to the ASP.NET based website and simulate GET/POST requests as if it were a "real" user. You would do this by using one of the native iOS HTTP clients (NSURLSession, for example) and would have to strip and parse the HTML you received back from the website in order to get the raw "data" required for your iOS app.
The situation you are describing is pretty complex and very brittle (you have to make a change to your iOS app every time any change is made to the ASP.NET website) and I would avoid this method of integration at all cost.

iOS app without API, alternatives?

Im thinking about learn to develop app for iOS. I had a lot of ideas, but most of them i would need the API of that website. For example: http://www.filmaffinity.com/en/main.html
The point is: is there any other possibility of collect/use information of a site without the API, anything else without the typical parsing or scraping?
Thanks you
To get the most up to date information to your users, you would need to use the API. If you want to store the data locally, you could do some initial scraping and build up your own database and distribute it within your app. This approach is not ideal because your data may become out of date quickly (unless you have a database update mechanism) and the owners of the sites you are scraping may not take too kindly on the matter

Resources