Class: Gitwrap::Org

Inherits:
GithubConnection show all
Defined in:
lib/gitwrap/orgs.rb

Constant Summary

Constants inherited from GithubConnection

GithubConnection::BASE_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Org

Returns a new instance of Org.



6
7
8
9
10
11
12
13
14
# File 'lib/gitwrap/orgs.rb', line 6

def initialize(hash)
  @id = hash["id"]
  @name = hash["login"]
  @site = hash["blog"]
  @location = hash["location"]
  @public_repos = hash["public_repos"]
  @followers = hash["followers"]
  @members = hash["members"]
end

Instance Attribute Details

#followersObject

Returns the value of attribute followers.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def followers
  @followers
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def id
  @id
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def location
  @location
end

#membersObject

Returns the value of attribute members.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def members
  @members
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def name
  @name
end

#public_reposObject

Returns the value of attribute public_repos.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def public_repos
  @public_repos
end

#siteObject

Returns the value of attribute site.



3
4
5
# File 'lib/gitwrap/orgs.rb', line 3

def site
  @site
end

Class Method Details

.fetch_all_orgsObject



20
21
22
23
24
# File 'lib/gitwrap/orgs.rb', line 20

def self.fetch_all_orgs
  orgs = Org.new({}).create_many_orgs("#{BASE_URL}organizations?since=#{$current_org}")
  $current_org += orgs.length-1
  orgs
end

.fetch_single_org(organization) ⇒ Object



16
17
18
# File 'lib/gitwrap/orgs.rb', line 16

def self.fetch_single_org(organization)
  org = Org.new({}).create_org("#{BASE_URL}orgs/#{organization}")
end