Class: Twitter::Client
- Inherits:
-
Object
- Object
- Twitter::Client
- Includes:
- API::Timelines
- Defined in:
- lib/twitter/client.rb
Overview
Note:
Inspired from twitter-4.5.0/spec/twitter/tweet_spec.rb
Constant Summary collapse
- ConnectionError =
Class.new(StandardError)
Instance Method Summary collapse
-
#get(path, qry = []) ⇒ Array<Hash>
Perform an HTTP get request against Twitter API then parse the result.
Methods included from API::Timelines
Instance Method Details
#get(path, qry = []) ⇒ Array<Hash>
Perform an HTTP get request against Twitter API then parse the result
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/twitter/client.rb', line 27 def get(path, qry=[]) uri = build_uri(path, qry) begin result = Net::HTTP.get(uri) rescue => ex pute uri, "Some network connection error: #{ex.inspect}" end pute uri, "The result contains errors: #{result}" if result =~ /error/ JSON.parse(result) end |