class RubychinaApi::Client
Attributes
avatar_url[R]
id[R]
meta[R]
name[R]
Public Class Methods
login(option)
click to toggle source
# File lib/rubychina_api/client.rb, line 12 def self.login(option) client = OAuth2::Client.new(RubychinaApi::Config.client_id, RubychinaApi::Config.secret, site: 'https://ruby-china.org') RubychinaApi::Config.access_token = client.password.get_token(option["username"], option["password"]).token response = RubychinaApi::Operation.get("hello") new(JSON.parse(response.body).fetch("user")) end
new(attributes)
click to toggle source
# File lib/rubychina_api/client.rb, line 5 def initialize(attributes) @id = attributes["id"] @name = attributes["name"] @avatar_url = attributes["avatar_url"] @meta = attributes["meta"] end