Class: GaExampleGem::Client
- Inherits:
-
Object
- Object
- GaExampleGem::Client
- Includes:
- Configuration, HTTParty
- Defined in:
- lib/ga_example_gem/client.rb
Overview
This is our client that we can initialize with GaExampleGem.new
Instance Attribute Summary
Attributes included from Configuration
Instance Method Summary collapse
-
#get_xkcd(number) ⇒ Object
This method gets the JSON for a single XKCD comic by number.
-
#initialize ⇒ Client
constructor
This resets our API keys when it is initialized.
Methods included from Configuration
Constructor Details
#initialize ⇒ Client
This resets our API keys when it is initialized
14 15 16 |
# File 'lib/ga_example_gem/client.rb', line 14 def initialize reset end |
Instance Method Details
#get_xkcd(number) ⇒ Object
This method gets the JSON for a single XKCD comic by number
20 21 22 23 24 |
# 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 |