Sha256: 8f6299254497d82bb953d4f220a3622f464484a1a43411cc70012c1daafa2282

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

require 'json'
require 'httparty'
require 'ga_example_gem/configuration'

module GaExampleGem
	
	# This is our client that we can initialize with
	# GaExampleGem.new
	class Client
		include GaExampleGem::Configuration
		include HTTParty

		# This resets our API keys when it is initialized
		def initialize
      reset
  	end

  	# This method gets the JSON for a single XKCD comic
  	# by number
  	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
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ga_example_gem-0.0.4 lib/ga_example_gem/client.rb
ga_example_gem-0.0.3 lib/ga_example_gem/client.rb