Class: Signnow::Base
- Inherits:
-
Object
- Object
- Signnow::Base
- Includes:
- Operations::All, Operations::Create, Operations::Find
- Defined in:
- lib/signnow/base.rb
Instance Attribute Summary collapse
-
#created ⇒ Object
Returns the value of attribute created.
Instance Method Summary collapse
-
#errors ⇒ Object
Accesor for the errors.
-
#initialize(attributes = {}) ⇒ Base
constructor
Initializes the object using the given attributes.
-
#parse_timestamps ⇒ Object
Parses UNIX timestamps and creates Time objects.
-
#set_attributes(attributes) ⇒ Object
Sets the attributes.
-
#valid? ⇒ Boolean
Model validations.
Methods included from Operations::Find
Methods included from Operations::Create
Methods included from Operations::All
Constructor Details
#initialize(attributes = {}) ⇒ Base
Initializes the object using the given attributes
12 13 14 15 |
# File 'lib/signnow/base.rb', line 12 def initialize(attributes = {}) set_attributes(attributes) end |
Instance Attribute Details
#created ⇒ Object
Returns the value of attribute created.
7 8 9 |
# File 'lib/signnow/base.rb', line 7 def created @created end |
Instance Method Details
#errors ⇒ Object
Accesor for the errors
26 27 28 |
# File 'lib/signnow/base.rb', line 26 def errors @errors || [] end |
#parse_timestamps ⇒ Object
Parses UNIX timestamps and creates Time objects.
40 41 42 43 |
# File 'lib/signnow/base.rb', line 40 def @created = created.to_i if created.is_a? String @created = Time.at(created) if created end |
#set_attributes(attributes) ⇒ Object
Sets the attributes
33 34 35 36 37 |
# File 'lib/signnow/base.rb', line 33 def set_attributes(attributes) attributes.each_pair do |key, value| instance_variable_set("@#{key}", value) end end |
#valid? ⇒ Boolean
Model validations
20 21 22 |
# File 'lib/signnow/base.rb', line 20 def valid? self.errors.empty? end |