Class: Gitwrap::Org
- Inherits:
-
GithubConnection
- Object
- GithubConnection
- Gitwrap::Org
- Defined in:
- lib/gitwrap/orgs.rb
Constant Summary
Constants inherited from GithubConnection
Instance Attribute Summary collapse
-
#followers ⇒ Object
Returns the value of attribute followers.
-
#id ⇒ Object
Returns the value of attribute id.
-
#location ⇒ Object
Returns the value of attribute location.
-
#members ⇒ Object
Returns the value of attribute members.
-
#name ⇒ Object
Returns the value of attribute name.
-
#public_repos ⇒ Object
Returns the value of attribute public_repos.
-
#site ⇒ Object
Returns the value of attribute site.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Org
constructor
A new instance of Org.
Constructor Details
#initialize(hash) ⇒ Org
Returns a new instance of Org.
7 8 9 10 11 12 13 14 15 |
# File 'lib/gitwrap/orgs.rb', line 7 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
#followers ⇒ Object
Returns the value of attribute followers.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def followers @followers end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def location @location end |
#members ⇒ Object
Returns the value of attribute members.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def members @members end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def name @name end |
#public_repos ⇒ Object
Returns the value of attribute public_repos.
3 4 5 |
# File 'lib/gitwrap/orgs.rb', line 3 def public_repos @public_repos end |
#site ⇒ Object
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_orgs ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/gitwrap/orgs.rb', line 23 def self.fetch_all_orgs data = open("#{BASE_URL}organizations?since=#{$current_org}").read() data = JSON.parse(data) data.each {|org| $all_orgs << new(org)} $current_org += orgs.length-1 $all_orgs end |
.fetch_single_org(organization) ⇒ Object
17 18 19 20 21 |
# File 'lib/gitwrap/orgs.rb', line 17 def self.fetch_single_org(organization) data = open("#{BASE_URL}orgs/#{organization}").open() data = JSON.parse(data) org = new(data) end |