Class: GoogleFT::Table::Permission
- Inherits:
-
Object
- Object
- GoogleFT::Table::Permission
- Defined in:
- lib/google-ft/table/permission.rb
Instance Attribute Summary collapse
-
#require_link ⇒ Object
Returns the value of attribute require_link.
-
#role ⇒ Object
Returns the value of attribute role.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(args) ⇒ Permission
constructor
A new instance of Permission.
- #post_args ⇒ Object
Constructor Details
#initialize(args) ⇒ Permission
Returns a new instance of Permission.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/google-ft/table/permission.rb', line 5 def initialize(args) # Clean up args and make sure we were at least supplied the required ones. args = args.symbolize.delete_if {|k,v| ![:role, :type, :value, :require_link].include?(k)} raise ArgumentError unless args[:role] && args[:type] # Set defaults. args[:value] ||= 'me' args[:require_link] ||= false # Set the attributes. self.role = args[:role] self.type = args[:type] self.value = args[:value] self.require_link = args[:require_link] end |
Instance Attribute Details
#require_link ⇒ Object
Returns the value of attribute require_link.
4 5 6 |
# File 'lib/google-ft/table/permission.rb', line 4 def require_link @require_link end |
#role ⇒ Object
Returns the value of attribute role.
4 5 6 |
# File 'lib/google-ft/table/permission.rb', line 4 def role @role end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/google-ft/table/permission.rb', line 4 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/google-ft/table/permission.rb', line 4 def value @value end |
Instance Method Details
#post_args ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/google-ft/table/permission.rb', line 21 def post_args # JSON formatted string for this permission. { :role => self.role, :type => self.type, :value => self.value, :withLink => self.require_link }.to_json end |