Module: Graham::API::Connection
- Included in:
- Graham::API
- Defined in:
- lib/graham/api/connection.rb
Instance Method Summary collapse
- #delete(url, option = nil) {|res, body| ... } ⇒ Object
- #get(url, option = nil) {|res, body| ... } ⇒ Object
- #post(url, option = nil) {|res, body| ... } ⇒ Object
Instance Method Details
#delete(url, option = nil) {|res, body| ... } ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/graham/api/connection.rb', line 22 def delete(url, option = nil) = prepareOption(option) res = config.conn.delete(url, ) body = JSON.parse res.body yield(res, body) if block_given? res end |
#get(url, option = nil) {|res, body| ... } ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/graham/api/connection.rb', line 14 def get(url, option = nil) = prepareOption(option) res = config.conn.get(url, ) body = JSON.parse res.body yield(res, body) if block_given? res end |
#post(url, option = nil) {|res, body| ... } ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/graham/api/connection.rb', line 6 def post(url, option = nil) = prepareOption(option) res = config.conn.post(url, ) body = JSON.parse res.body yield(res, body) if block_given? res end |