Class: Github::Repository
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Github::Repository
- Includes:
- Api
- Defined in:
- lib/github.rb
Constant Summary collapse
- ATTR_NAMES =
[:name, :url, :owner_name, :owner_email]
Instance Method Summary collapse
Methods included from Api
Methods inherited from OpenStruct
Instance Method Details
#owner_email ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/github.rb', line 74 def owner_email if owner.is_a?(Hash) && email = owner['email'] return email if email end if organization Organization.fetch(:name => organization).member_emails else User.fetch(:name => owner_name).email end end |
#owner_name ⇒ Object
70 71 72 |
# File 'lib/github.rb', line 70 def owner_name owner.is_a?(Hash) ? owner['name'] : owner end |
#path ⇒ Object
86 87 88 |
# File 'lib/github.rb', line 86 def path "repos/show/#{owner_name}/#{name}" end |
#private? ⇒ Boolean
90 91 92 |
# File 'lib/github.rb', line 90 def private? self['private'] end |
#to_hash ⇒ Object
66 67 68 |
# File 'lib/github.rb', line 66 def to_hash ATTR_NAMES.inject({}) { |result, name| result.merge(name => self.send(name)) } end |