Class: Tweetwine::Http::Resource
- Inherits:
-
Object
- Object
- Tweetwine::Http::Resource
- Defined in:
- lib/tweetwine/http.rb
Instance Method Summary collapse
- #[](suburl) ⇒ Object
- #get(headers = nil, &block) ⇒ Object
-
#initialize(client, url) ⇒ Resource
constructor
A new instance of Resource.
- #post(payload = nil, headers = nil, &block) ⇒ Object
Constructor Details
#initialize(client, url) ⇒ Resource
Returns a new instance of Resource.
100 101 102 103 |
# File 'lib/tweetwine/http.rb', line 100 def initialize(client, url) @client = client @url = url end |
Instance Method Details
#[](suburl) ⇒ Object
105 106 107 |
# File 'lib/tweetwine/http.rb', line 105 def [](suburl) self.class.new(@client, "#{@url}/#{suburl}") end |
#get(headers = nil, &block) ⇒ Object
109 110 111 |
# File 'lib/tweetwine/http.rb', line 109 def get(headers = nil, &block) @client.get(@url, headers, &block) end |
#post(payload = nil, headers = nil, &block) ⇒ Object
113 114 115 |
# File 'lib/tweetwine/http.rb', line 113 def post(payload = nil, headers = nil, &block) @client.post(@url, payload, headers, &block) end |