Class: TinyPassport::AccountQuery
- Inherits:
-
Object
- Object
- TinyPassport::AccountQuery
- Includes:
- QueryAble
- Defined in:
- app/queries/tiny_passport/account_query.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
Instance Method Summary collapse
-
#initialize(account) ⇒ AccountQuery
constructor
A new instance of AccountQuery.
-
#oauth_logins_data(options = {}) ⇒ Object
{ :oauth_logins => [ { :strategy => => :taobao, :id => ‘ABCDEFGHIJK’, :nick_name => ‘ABCE’, :name => ‘ABCE’, :avatar => { :normal => ”, :big => ”, :origin => ”, }, :crated_at => ‘2013-12-30 23:22:34’, :updated_at => ‘2013-12-30 23:22:34’, :expires_at => ‘2013-12-30 23:22:34’, :access_token => ”, :access_secret => ”, :status => => 1, :key => :default } ] }.
Methods included from QueryAble
Constructor Details
#initialize(account) ⇒ AccountQuery
Returns a new instance of AccountQuery.
7 8 9 |
# File 'app/queries/tiny_passport/account_query.rb', line 7 def initialize account @account = account end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
5 6 7 |
# File 'app/queries/tiny_passport/account_query.rb', line 5 def account @account end |
Instance Method Details
#oauth_logins_data(options = {}) ⇒ Object
:oauth_logins => [
{
:strategy => {:type => :taobao, :id => 'ABCDEFGHIJK',
:nick_name => 'ABCE',
:name => 'ABCE',
:avatar => {
:normal => '',
:big => '',
:origin => '',
},
:crated_at => '2013-12-30 23:22:34',
:updated_at => '2013-12-30 23:22:34',
:expires_at => '2013-12-30 23:22:34',
:access_token => '',
:access_secret => '',
:status => => 1, :key => :default
}
]
}
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/queries/tiny_passport/account_query.rb', line 31 def oauth_logins_data ={} = oauth_logins = self.account.oauth_logins.joins(:oauth_token).page([:page] || 1).per([:per_page] || 20) result = {} result[:oauth_logins] = oauth_logins.map do |login| login.display.basic end result end |