Class: Ghub::Models::Restriction

Inherits:
Struct
  • Object
show all
Defined in:
lib/ghub/models/restriction.rb

Overview

Defines a restriction.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRestriction

Returns a new instance of Restriction.



27
28
29
30
# File 'lib/ghub/models/restriction.rb', line 27

def initialize(**)
  super
  freeze
end

Instance Attribute Details

#appsObject

Returns the value of attribute apps

Returns:

  • (Object)

    the current value of apps



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def apps
  @apps
end

#apps_urlObject

Returns the value of attribute apps_url

Returns:

  • (Object)

    the current value of apps_url



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def apps_url
  @apps_url
end

#teamsObject

Returns the value of attribute teams

Returns:

  • (Object)

    the current value of teams



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def teams
  @teams
end

#teams_urlObject

Returns the value of attribute teams_url

Returns:

  • (Object)

    the current value of teams_url



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def teams_url
  @teams_url
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def url
  @url
end

#usersObject

Returns the value of attribute users

Returns:

  • (Object)

    the current value of users



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def users
  @users
end

#users_urlObject

Returns the value of attribute users_url

Returns:

  • (Object)

    the current value of users_url



6
7
8
# File 'lib/ghub/models/restriction.rb', line 6

def users_url
  @users_url
end

Class Method Details

.for(**attributes) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ghub/models/restriction.rb', line 15

def self.for(**attributes)
  return new if attributes.empty?

  new(
    **attributes.merge!(
      apps: attributes[:apps].map { |arguments| Application[**arguments] },
      teams: attributes[:teams].map { |arguments| Team[**arguments] },
      users: attributes[:users].map { |arguments| User[**arguments] }
    )
  )
end