Class: StarkBank::User

Inherits:
StarkBank::Utils::Resource show all
Defined in:
lib/user/user.rb

Direct Known Subclasses

Project

Instance Attribute Summary collapse

Attributes inherited from StarkBank::Utils::Resource

#id

Instance Method Summary collapse

Methods inherited from StarkBank::Utils::Resource

#inspect, #to_s

Constructor Details

#initialize(environment, id, private_key) ⇒ User

Returns a new instance of User.



10
11
12
13
14
# File 'lib/user/user.rb', line 10

def initialize(environment, id, private_key)
  super(id)
  @pem = StarkBank::Utils::Checks.check_private_key(private_key)
  @environment = StarkBank::Utils::Checks.check_environment(environment)
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

#pemObject (readonly)

Returns the value of attribute pem.



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

def pem
  @pem
end

Instance Method Details

#access_idObject



16
17
18
# File 'lib/user/user.rb', line 16

def access_id
  "#{self.class.name.split('::').last.downcase}/#{@id}"
end

#private_keyObject



20
21
22
# File 'lib/user/user.rb', line 20

def private_key
  EllipticCurve::PrivateKey.fromPem(@pem)
end