Class: Embulk::Input::JiraApi::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/embulk/input/jira_api/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Issue

Returns a new instance of Issue.



7
8
9
10
11
12
13
# File 'lib/embulk/input/jira_api/issue.rb', line 7

def initialize(attributes)
  @id = attributes.fetch("id")

  # https://github.com/dorack/jiralicious/blob/404b7b6d5b7020f42064cf8d7a745ab02057e728/lib/jiralicious/issue.rb#L11-L12
  @key = attributes.fetch("jira_key")
  @fields = attributes.fetch("fields")
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



5
6
7
# File 'lib/embulk/input/jira_api/issue.rb', line 5

def fields
  @fields
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/embulk/input/jira_api/issue.rb', line 5

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/embulk/input/jira_api/issue.rb', line 5

def key
  @key
end

Instance Method Details

#[](attribute) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/embulk/input/jira_api/issue.rb', line 15

def [](attribute)
  case attribute
  when "id"
    return id
  when "key"
    return key
  end

  attribute_keys = attribute.split('.')

  fetch(fields, attribute_keys)
end

#to_recordObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/embulk/input/jira_api/issue.rb', line 28

def to_record
  @record = {}

  @record["id"] = id
  @record["key"] = key

  generate_record(fields, "")

  @record
end