Class: Jira::StoryMapper
- Inherits:
-
Object
- Object
- Jira::StoryMapper
- Defined in:
- lib/jira.rb
Instance Method Summary collapse
- #configure!(config) ⇒ Object
-
#initialize ⇒ StoryMapper
constructor
A new instance of StoryMapper.
- #map(story) ⇒ Object
Constructor Details
#initialize ⇒ StoryMapper
Returns a new instance of StoryMapper.
106 107 108 |
# File 'lib/jira.rb', line 106 def initialize @map = default_mapping end |
Instance Method Details
#configure!(config) ⇒ Object
110 111 112 113 114 115 |
# File 'lib/jira.rb', line 110 def configure!(config) config[:mappings].each do |mapping| field, map = mapping @map[field] = map.to_hash end end |
#map(story) ⇒ Object
117 118 119 120 121 122 123 |
# File 'lib/jira.rb', line 117 def map(story) fields = story.to_hash.inject({}) do |hash, (key, value)| hash.merge!(do_map(key, value)) hash end {:fields => fields} end |