Class: 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

Methods included from DataCreator

#create_many_orgs, #create_many_repos, #create_many_users, #create_org, #create_org_repos, #create_single_repo, #create_user, #create_user_repos, #parse_data

Constructor Details

#initialize(hash) ⇒ Org

Returns a new instance of Org.



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

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.



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

def followers
  @followers
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#membersObject

Returns the value of attribute members.



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

def members
  @members
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#public_reposObject

Returns the value of attribute public_repos.



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

def public_repos
  @public_repos
end

#siteObject

Returns the value of attribute site.



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

def site
  @site
end

Class Method Details

.fetch_all_orgsObject



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

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



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

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