Class: OpConnect::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/op_connect/item.rb,
lib/op_connect/item/url.rb,
lib/op_connect/item/file.rb,
lib/op_connect/item/field.rb,
lib/op_connect/item/section.rb,
lib/op_connect/item/generator_recipe.rb

Defined Under Namespace

Classes: Field, File, GeneratorRecipe, Section, URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Item

Returns a new instance of Item.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/op_connect/item.rb', line 13

def initialize(options = {})
  @id = options["id"]
  @title = options["title"]
  @vault = Object.new(options["vault"])
  @category = options["category"]
  @urls = options["urls"]&.collect! { |url| URL.new(url) }
  @is_favorite = options["favorite"] || false
  @tags = options["tags"]
  @version = options["version"]
  @state = options["state"]
  @sections = options["sections"]&.collect! { |section| Section.new(section) } || []
  @fields = options["fields"]&.collect! { |field| Field.new(field) } || []
  @files = options["files"]&.collect! { |file| File.new(file) } || []
  @created_at = options["createdAt"]
  @updated_at = options["updatedAt"]
  @last_edited_by = options["lastEditedBy"]
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



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

def category
  @category
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#fieldsObject (readonly)

Returns the value of attribute fields.



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

def fields
  @fields
end

#filesObject (readonly)

Returns the value of attribute files.



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

def files
  @files
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#is_favoriteObject (readonly) Also known as: favorite?

Returns the value of attribute is_favorite.



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

def is_favorite
  @is_favorite
end

#last_edited_byObject (readonly)

Returns the value of attribute last_edited_by.



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

def last_edited_by
  @last_edited_by
end

#sectionsObject (readonly)

Returns the value of attribute sections.



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

def sections
  @sections
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

#tagsObject (readonly)

Returns the value of attribute tags.



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

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#urlsObject (readonly)

Returns the value of attribute urls.



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

def urls
  @urls
end

#vaultObject (readonly)

Returns the value of attribute vault.



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

def vault
  @vault
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end