Module: Consumer

Defined in:
lib/consumer.rb,
lib/consumer/proxy.rb,
lib/consumer/version.rb

Defined Under Namespace

Classes: Proxy

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.build(hash) ⇒ Object



15
16
17
18
19
# File 'lib/consumer.rb', line 15

def self.build(hash)
  hash.is_a?(Array) ?
    hash.map { |h| Consumer::Proxy.new(h)} :
    Consumer::Proxy.new(hash)
end

.get(url) ⇒ Object



8
9
10
11
12
13
# File 'lib/consumer.rb', line 8

def self.get(url)
  json = open(url).read
  hash = JSON.parse(json)

  build(hash)
end