Class: AWeber::Base
- Inherits:
-
Object
- Object
- AWeber::Base
- Defined in:
- lib/aweber/base.rb
Instance Method Summary collapse
- #account ⇒ Object
- #delete(uri) ⇒ Object
- #get(uri) ⇒ Object
-
#initialize(oauth) ⇒ Base
constructor
A new instance of Base.
- #put(uri, body = {}) ⇒ Object
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
#account ⇒ Object
8 9 10 |
# File 'lib/aweber/base.rb', line 8 def account accounts.first.last end |
#delete(uri) ⇒ Object
18 19 20 |
# File 'lib/aweber/base.rb', line 18 def delete(uri) oauth.delete((uri)) end |
#get(uri) ⇒ Object
12 13 14 15 16 |
# File 'lib/aweber/base.rb', line 12 def get(uri) response = oauth.get((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 |