Class: Macaroons::Caveat

Inherits:
Object
  • Object
show all
Defined in:
lib/macaroons/caveat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(caveat_id, verification_id = nil, caveat_location = nil) ⇒ Caveat

Returns a new instance of Caveat.



3
4
5
6
7
# File 'lib/macaroons/caveat.rb', line 3

def initialize(caveat_id, verification_id=nil, caveat_location=nil)
  @caveat_id = caveat_id
  @verification_id = verification_id
  @caveat_location = caveat_location
end

Instance Attribute Details

#caveat_idObject

Returns the value of attribute caveat_id.



9
10
11
# File 'lib/macaroons/caveat.rb', line 9

def caveat_id
  @caveat_id
end

#caveat_locationObject

Returns the value of attribute caveat_location.



11
12
13
# File 'lib/macaroons/caveat.rb', line 11

def caveat_location
  @caveat_location
end

#verification_idObject

Returns the value of attribute verification_id.



10
11
12
# File 'lib/macaroons/caveat.rb', line 10

def verification_id
  @verification_id
end

Instance Method Details

#first_party?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/macaroons/caveat.rb', line 13

def first_party?
  verification_id.nil?
end

#third_party?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/macaroons/caveat.rb', line 17

def third_party?
  !first_party?
end

#to_hObject



21
22
23
# File 'lib/macaroons/caveat.rb', line 21

def to_h
  {'cid' => @caveat_id, 'vid' => @verification_id, 'cl' => @caveat_location}
end