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.
- #inspect ⇒ Object
- #path ⇒ Object
- #post(uri, body = {}) ⇒ Object
- #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 |
#inspect ⇒ Object
34 35 36 |
# File 'lib/aweber/base.rb', line 34 def inspect "#<AWeber::Base />" end |
#path ⇒ Object
30 31 32 |
# File 'lib/aweber/base.rb', line 30 def path "" end |
#post(uri, body = {}) ⇒ Object
22 23 24 |
# File 'lib/aweber/base.rb', line 22 def post(uri, body={}) oauth.post((uri), body) end |
#put(uri, body = {}) ⇒ Object
26 27 28 |
# File 'lib/aweber/base.rb', line 26 def put(uri, body={}) oauth.put(uri, body.to_json, {"Content-Type" => "application/json"}) end |