Class: GithubMembers::Client
- Inherits:
-
Object
- Object
- GithubMembers::Client
- Defined in:
- lib/github_members/client.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #fetch_members(org) ⇒ Object
- #fetch_organization(org) ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/github_members/client.rb', line 7 def initialize() @options = Octokit.configure do |c| token = .github_token c.access_token = token unless token.empty? c.auto_paginate = true c.per_page = 100 end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/github_members/client.rb', line 5 def @options end |
Instance Method Details
#fetch_members(org) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/github_members/client.rb', line 18 def fetch_members(org) Octokit.organization_members(org).map do |gh_member| gh_user = Octokit.user(gh_member.login) fullname = gh_user.name.then { |name| name.to_s.empty? ? "" : name } { github: gh_member.login, fullname: fullname, avatar: gh_member.avatar_url } end end |
#fetch_organization(org) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/github_members/client.rb', line 31 def fetch_organization(org) Octokit.organization(org).then do |gh_org| { name: gh_org.login, fullname: gh_org.name, url: gh_org.html_url } end end |