Class: AWeber::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/aweber/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(oauth) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/aweber/base.rb', line 4

def initialize(oauth)
  @oauth = oauth
end

Instance Method Details

#accountObject



8
9
10
# File 'lib/aweber/base.rb', line 8

def 
  accounts.first.last
end

#delete(uri) ⇒ Object



18
19
20
# File 'lib/aweber/base.rb', line 18

def delete(uri)
  oauth.delete(expand(uri))
end

#get(uri) ⇒ Object



12
13
14
15
16
# File 'lib/aweber/base.rb', line 12

def get(uri)
  response = oauth.get(expand(uri))
  handle_errors(response, uri)
  parse(response) if response
end

#put(uri, body = {}) ⇒ Object



22
23
24
# File 'lib/aweber/base.rb', line 22

def put(uri, body={})
  oauth.put(uri, body.to_json, {"Content-Type" => "application/json"})
end