0.0
No release in over 3 years
Low commit activity in last 3 years
Get JSON data from RestAPI with httparty and create Daru::DataFrame.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0

Runtime

>= 0
 Project Readme

🔶 Daru::APIClient 🔶

Gem Version

🔸Overview🔸

Get JSON data from Rest API with httparty and create Daru::DataFrame.

🔸Installation🔸

gem install daru-apiclient

🔸Requirements🔸

  • Ruby
  • Daru
  • httparty
  • Jupyter notebook with IRuby (reccomended)

🔸Examples🔸

Get BestGems.org's data using API. alt text

juypter notebook
require 'daru/apiclient'
require 'daru/view'
Daru::View.plotting_library = :googlecharts

C = Daru::APIClient.new "http://bestgems.org/api/v1/gems"

def bestgems(gem)
  df = C.get("/#{gem}/daily_downloads.json")
  df.rename_vectors "daily_downloads" => gem
  df
end

rack = bestgems "rack"
rake = bestgems "rake"
json = bestgems "json"
thor = bestgems "thor"

df = rack.join(rake, how: :inner, on: ["date"])
         .join(json, how: :inner, on: ["date"])
         .join(thor, how: :inner, on: ["date"])

df.order = ["date", "rack", "rake", "json", "thor"]
df.sort!(["date"])
df = df.row[-300..-20]

chart = Daru::View::Plot.new(df,
  type: :area,
  isStacked: true,
  height: 400
  )
chart.show_in_iruby

🔸Development🔸

  • This gem will keeps its simplicity.

🔸Contributing🔸

Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/daru-apiclient.

🔸License🔸

The gem is available as open source under the terms of the MIT License.