Module: HaveAPI::Resources::ActionState::Mixin
Instance Method Summary collapse
Instance Method Details
#state_to_hash(state) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/haveapi/resources/action_state.rb', line 27 def state_to_hash(state) hash = { id: state.id, label: state.label, status: state.status, created_at: state.created_at, updated_at: state.updated_at, can_cancel: state.can_cancel? } hash[:finished] = state.finished? progress = state.progress hash[:current] = progress[:current] || 0 hash[:total] = progress[:total] || 0 hash[:unit] = progress[:unit] hash end |