Class: StarkInfra::CreditSigner
- Inherits:
-
StarkCore::Utils::Resource
- Object
- StarkCore::Utils::Resource
- StarkInfra::CreditSigner
- Defined in:
- lib/creditsigner/creditsigner.rb
Overview
# CreditSigner object
CreditNote signer’s information.
## Parameters (required):
-
name [string]: signer’s name. ex: ‘Tony Stark’
-
contact [string]: signer’s contact information. ex: ‘[email protected]’
-
method [string]: delivery method for the contract. ex: ‘link’
## Attributes (return-only):
-
id [string]: unique id returned when the CreditSigner is created. ex: ‘5656565656565656’
Instance Attribute Summary collapse
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, contact:, method:, id: nil) ⇒ CreditSigner
constructor
A new instance of CreditSigner.
Constructor Details
#initialize(name:, contact:, method:, id: nil) ⇒ CreditSigner
Returns a new instance of CreditSigner.
19 20 21 22 23 24 |
# File 'lib/creditsigner/creditsigner.rb', line 19 def initialize(name:, contact:, method:, id: nil) super(id) @name = name @contact = contact @method = method end |
Instance Attribute Details
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
18 19 20 |
# File 'lib/creditsigner/creditsigner.rb', line 18 def contact @contact end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'lib/creditsigner/creditsigner.rb', line 18 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
18 19 20 |
# File 'lib/creditsigner/creditsigner.rb', line 18 def method @method end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/creditsigner/creditsigner.rb', line 18 def name @name end |
Class Method Details
.parse_signers(signers) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/creditsigner/creditsigner.rb', line 26 def self.parse_signers(signers) resource_maker = StarkInfra::CreditSigner.resource[:resource_maker] return signers if signers.nil? parsed_signers = [] signers.each do |signer| unless signer.is_a? CreditSigner signer = StarkCore::Utils::API.from_api_json(resource_maker, signer) end parsed_signers << signer end parsed_signers end |
.resource ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/creditsigner/creditsigner.rb', line 40 def self.resource { resource_name: 'CreditSigner', resource_maker: proc { |json| CreditSigner.new( id: json['id'], name: json['name'], contact: json['contact'], method: json['method'] ) } } end |