Module: Bullfrog

Includes:
HTTParty
Defined in:
lib/bullfrog.rb,
lib/bullfrog/version.rb

Defined Under Namespace

Classes: TTS

Constant Summary collapse

API_VERSION =
1
VERSION =
"0.0.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



11
12
13
# File 'lib/bullfrog.rb', line 11

def api_key
  @api_key
end

Class Method Details

.api_options(options) ⇒ Object



27
28
29
30
31
# File 'lib/bullfrog.rb', line 27

def api_options(options)
  options[:body] ||= {}
  options[:body][:api_key] = @api_key
  options
end

.api_url(url) ⇒ Object



24
25
26
# File 'lib/bullfrog.rb', line 24

def api_url(url)
  "/api/v#{API_VERSION}/#{url}.js"
end

.get(url, options = {}) ⇒ Object



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

def get(url, options = {})
  response = super(api_url(url), api_options(options))
  JSON.parse(response.body)
end

.post(url, options = {}) ⇒ Object



12
13
14
15
# File 'lib/bullfrog.rb', line 12

def post(url, options = {})
  response = super(api_url(url), api_options(options))
  JSON.parse(response.body)
end

.put(url, options = {}) ⇒ Object



20
21
22
23
# File 'lib/bullfrog.rb', line 20

def put(url, options = {})
  response = super(api_url(url), api_options(options))
  JSON.parse(response.body)
end