Class: Coderbits::Client
- Inherits:
-
Object
- Object
- Coderbits::Client
- Defined in:
- lib/coderbits/client.rb
Constant Summary collapse
- OPTIONS =
valid options
[:account, :callback]
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
connection.
Instance Method Summary collapse
-
#get(username, options = {}) ⇒ Object
Coderbits::Client.new.get username: ‘artemeff’.
-
#initialize ⇒ Object
constructor
Coderbits::Client.new.
Constructor Details
#initialize ⇒ Object
Coderbits::Client.new
15 16 17 |
# File 'lib/coderbits/client.rb', line 15 def initialize @connection = Faraday.new url: "https://coderbits.com" end |
Instance Attribute Details
#connection ⇒ Object (readonly)
connection
10 11 12 |
# File 'lib/coderbits/client.rb', line 10 def connection @connection end |
Instance Method Details
#get(username, options = {}) ⇒ Object
Coderbits::Client.new.get username: ‘artemeff’
20 21 22 23 24 25 26 27 28 |
# File 'lib/coderbits/client.rb', line 20 def get username, = {} response = @connection.get "/#{username}.json", safe() if [:callback] response.body else MultiJson.load response.body, symbolize_keys: true end end |