class GaExampleGem::Client

This is our client that we can initialize with GaExampleGem.new

Public Class Methods

new() click to toggle source

This resets our API keys when it is initialized

# File lib/ga_example_gem/client.rb, line 14
          def initialize
reset
  end

Public Instance Methods

get_xkcd(number) click to toggle source

This method gets the JSON for a single XKCD comic by number

# File lib/ga_example_gem/client.rb, line 20
def get_xkcd(number)
        # This works too
        # JSON.parse self.class.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}")
        JSON.parse HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}")
end