Module: WWDC::Helpers

Defined in:
lib/wwdc/helpers.rb

Instance Method Summary collapse

Instance Method Details

#describe(session) ⇒ Object



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

def describe(session)
  puts %{\033[1m#{session['number']}: "#{session['title']}"\033[0m}
  puts session['description']
  puts
end

#get(options = {}) {|response| ... } ⇒ Object

Yields:

  • (response)


6
7
8
9
10
11
12
13
# File 'lib/wwdc/helpers.rb', line 6

def get(options = {}, &block)
  response = client.get(options)
  say_error "Error #{response.status}" and abort unless response.status == 200

  yield response if block_given?

  JSON.parse(response.body)
end